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