Sink Fixes? version bump

version bump just due to api changes.
Also i made a fix for the sink but have yet to test it should work since
its exactly the same as the cauldran but with meta turned into
liquidstack volume
This commit is contained in:
Rseifert 2013-02-03 19:28:26 -05:00
parent 3c0a93ed22
commit a7683ab2fd
4 changed files with 37 additions and 64 deletions

View file

@ -1 +1 @@
14
15

View file

@ -12,3 +12,4 @@ x Fluid-Mechanics_v0.2.5.6.jar Fluid-Mechanics_v0.2.5.6_api.zip
@ Fluid-Mechanics_v0.2.6.12.jar Fluid-Mechanics_v0.2.6.12_api.zip
@ Fluid-Mechanics_v0.2.6.13.jar Fluid-Mechanics_v0.2.6.13_api.zip
* Fluid-Mechanics_v0.2.6.14.jar Fluid-Mechanics_v0.2.6.14_api.zip
x Fluid-Mechanics_v0.2.7.15.jar Fluid-Mechanics_v0.2.7.15_api.zip

View file

@ -1 +1 @@
0.2.6
0.2.7

View file

@ -44,69 +44,42 @@ public class BlockSink extends BlockMachine
@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();
TileEntity ent = world.getBlockTileEntity(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
int grouping = MetaGroup.getGrouping(meta);
if (heldItem == null || !(ent instanceof TileEntitySink)) { return false; }
TileEntitySink sink = (TileEntitySink) ent;
if (world.isRemote)
{
return true;
}
else
{
ILiquidTank tank = sink.getTanks(ForgeDirection.UNKNOWN)[0];
LiquidStack stack = tank.getLiquid();
if (grouping == 0 || grouping == 1)
ItemStack heldItem = player.inventory.getCurrentItem();
TileEntity ent = world.getBlockTileEntity(x, y, z);
ForgeDirection facing = ForgeDirection.getOrientation(side);
if (heldItem == null || !(ent instanceof TileEntitySink))
{
if (heldItem.itemID == Item.bucketWater.itemID)
return true;
}
else
{
LiquidStack filling = LiquidContainerRegistry.getLiquidForFilledItem(heldItem);
if (stack == null || (stack != null && stack.amount < tank.getCapacity()))
TileEntitySink sink = (TileEntitySink) ent;
LiquidStack stack = sink.getStack();
if (heldItem.itemID == Item.bucketWater.itemID && stack != null && stack.amount < sink.getTanks(facing)[0].getCapacity())
{
int f = sink.fill(ForgeDirection.getOrientation(side), filling, true);
if (f > 0)
int f = sink.fill(facing, LiquidContainerRegistry.getLiquidForFilledItem(heldItem), false);
if (f >= (LiquidContainerRegistry.BUCKET_VOLUME / 2))
{
if (!player.capabilities.isCreativeMode)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Item.bucketEmpty));
}
sink.fill(facing, LiquidContainerRegistry.getLiquidForFilledItem(heldItem), true);
}
return true;
}
}
}
else if (heldItem.itemID == Item.bucketEmpty.itemID)
{
LiquidStack drain = tank.drain(LiquidContainerRegistry.BUCKET_VOLUME, false);
if (drain != null && drain.amount >= LiquidContainerRegistry.BUCKET_VOLUME)
{
ItemStack var12 = new ItemStack(Item.bucketEmpty, 1, 0);
if (!player.inventory.addItemStackToInventory(heldItem))
{
world.spawnEntityInWorld(new EntityItem(world, (double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D, var12));
}
else if (player instanceof EntityPlayerMP)
{
((EntityPlayerMP) player).sendContainerToPlayer(player.inventoryContainer);
}
--heldItem.stackSize;
if (heldItem.stackSize <= 0)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null);
}
tank.drain(LiquidContainerRegistry.BUCKET_VOLUME, true);
return true;
}
}
else if (heldItem.itemID == Item.glassBottle.itemID)
{
LiquidStack drain = tank.drain(LiquidContainerRegistry.BUCKET_VOLUME / 4, false);
if (drain != null && drain.amount >= LiquidContainerRegistry.BUCKET_VOLUME / 4)
else if (heldItem.itemID == Item.glassBottle.itemID && sink.drain(side, LiquidContainerRegistry.BUCKET_VOLUME, false).amount > (LiquidContainerRegistry.BUCKET_VOLUME / 4))
{
sink.drain(side, (LiquidContainerRegistry.BUCKET_VOLUME / 4), true);
ItemStack var12 = new ItemStack(Item.potion, 1, 0);
if (!player.inventory.addItemStackToInventory(var12))
{
world.spawnEntityInWorld(new EntityItem(world, (double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D, var12));
@ -122,9 +95,6 @@ public class BlockSink extends BlockMachine
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null);
}
tank.drain(LiquidContainerRegistry.BUCKET_VOLUME / 4, true);
return true;
}
}
else if (heldItem.getItem() instanceof ItemArmor && ((ItemArmor) heldItem.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH)
{
@ -132,9 +102,11 @@ public class BlockSink extends BlockMachine
var13.removeColor(heldItem);
return true;
}
return true;
}
}
return false;
}
@Override