Added wrench support and removed debug

forgot to remove a debug message for placement of meta for the pump
*Added: wrench rotation support for sink
*Added: wrench rotation support for pump
*Fixed: pump delay and reduce its time
This commit is contained in:
Rseifert 2013-01-23 05:00:15 -05:00
parent ec8971b627
commit dda6237c89
3 changed files with 50 additions and 18 deletions

View file

@ -35,15 +35,6 @@ public class BlockPumpMachine extends BlockMachine
this.setResistance(5f); this.setResistance(5f);
} }
public void onBlockAdded(World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (MetaGroup.getGrouping(meta) == 1)
{
world.setBlockAndMetadata(x, y, z, LiquidMechanics.blockTank.blockID, 15);
}
}
@Override @Override
public boolean isOpaqueCube() public boolean isOpaqueCube()
{ {
@ -99,7 +90,8 @@ public class BlockPumpMachine extends BlockMachine
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID); world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
if (p instanceof EntityPlayer) if (p instanceof EntityPlayer)
{ {
((EntityPlayer) p).sendChatToPlayer("meta:" + world.getBlockMetadata(x, y, z)); // ((EntityPlayer) p).sendChatToPlayer("meta:" +
// world.getBlockMetadata(x, y, z));
} }
} }
@ -129,4 +121,24 @@ public class BlockPumpMachine extends BlockMachine
{ {
par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 0));
} }
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (meta == (g * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4));
return true;
}
else
{
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1);
return true;
}
//return false;
}
} }

View file

@ -1,5 +1,6 @@
package liquidmechanics.common.block; package liquidmechanics.common.block;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.tile.TileEntityAdvanced; import universalelectricity.prefab.tile.TileEntityAdvanced;
import liquidmechanics.client.render.BlockRenderHelper; import liquidmechanics.client.render.BlockRenderHelper;
import liquidmechanics.common.MetaGroup; import liquidmechanics.common.MetaGroup;
@ -25,15 +26,13 @@ import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidContainerRegistry; import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.liquids.LiquidStack;
public class BlockSink extends BlockContainer public class BlockSink extends BlockMachine
{ {
public BlockSink(int par1) public BlockSink(int par1)
{ {
super(par1, Material.iron); super("lmSink", par1, Material.iron, TabLiquidMechanics.INSTANCE);
this.setResistance(4f); this.setResistance(4f);
this.setHardness(4f); this.setHardness(4f);
this.setBlockName("lmSink");
this.setCreativeTab(TabLiquidMechanics.INSTANCE);
} }
@Override @Override
@ -42,7 +41,8 @@ public class BlockSink extends BlockContainer
return new TileEntitySink(); return new TileEntitySink();
} }
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float sx, float sy, float sz) @Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float sx, float sy, float sz)
{ {
ItemStack heldItem = player.inventory.getCurrentItem(); ItemStack heldItem = player.inventory.getCurrentItem();
TileEntity ent = world.getBlockTileEntity(x, y, z); TileEntity ent = world.getBlockTileEntity(x, y, z);
@ -57,8 +57,6 @@ public class BlockSink extends BlockContainer
return true; return true;
} }
else else
// ItemStack var12 = new ItemStack(Item.potion, 1, 0);heldItem.itemID ==
// Item.glassBottle.itemID
{ {
ILiquidTank tank = sink.getTanks(ForgeDirection.UNKNOWN)[0]; ILiquidTank tank = sink.getTanks(ForgeDirection.UNKNOWN)[0];
LiquidStack stack = tank.getLiquid(); LiquidStack stack = tank.getLiquid();
@ -109,6 +107,27 @@ public class BlockSink extends BlockContainer
return false; return false;
} }
@Override
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
int meta = par1World.getBlockMetadata(x, y, z);
int g = MetaGroup.getGrouping(meta);
TileEntity ent = par1World.getBlockTileEntity(x, y, z);
int angle = MathHelper.floor_double((par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (meta == (g * 4) + 3)
{
par1World.setBlockMetadataWithNotify(x, y, z, (g * 4));
return true;
}
else
{
par1World.setBlockMetadataWithNotify(x, y, z, meta + 1);
return true;
}
// return false;
}
@Override @Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving) public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving par5EntityLiving)
{ {

View file

@ -110,8 +110,9 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
{ {
pos = 0; pos = 0;
} }
if (percentPumped++ >= 20) if (percentPumped++ >= 10)
{ {
percentPumped = 0;
this.drainBlock(new Vector3(xCoord, yCoord - 1, zCoord)); this.drainBlock(new Vector3(xCoord, yCoord - 1, zCoord));
} }
} }