Added ability to put liquid in the tank from non-standard capacity containers.

This commit is contained in:
CovertJaguar 2012-07-14 07:33:54 -07:00
parent 29b074acf5
commit 18ba26eff2

View file

@ -92,12 +92,12 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
ItemStack current = entityplayer.inventory.getCurrentItem(); ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null) { if (current != null) {
int liquidId = LiquidManager.getLiquidIDForFilledItem(current); LiquidStack liquid = LiquidManager.getLiquidForFilledItem(current);
TileTank tank = (TileTank) world.getBlockTileEntity(i, j, k); TileTank tank = (TileTank) world.getBlockTileEntity(i, j, k);
if (liquidId != 0) { if (liquid != null) {
int qty = tank.fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, true); int qty = tank.fill(Orientations.Unknown, liquid.amount, liquidId, true);
if (qty != 0 && !BuildCraftCore.debugMode) { if (qty != 0 && !BuildCraftCore.debugMode) {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
@ -110,7 +110,7 @@ public class BlockTank extends BlockContainer implements ITextureProvider {
int qty = tank.empty(BuildCraftAPI.BUCKET_VOLUME, false); int qty = tank.empty(BuildCraftAPI.BUCKET_VOLUME, false);
LiquidStack liquid = LiquidManager.getLiquidForFilledItem(filled); liquid = LiquidManager.getLiquidForFilledItem(filled);
if(liquid != null && qty >= liquid.amount){ if(liquid != null && qty >= liquid.amount){
if(current.stackSize > 1 && !entityplayer.inventory.addItemStackToInventory(filled)){ if(current.stackSize > 1 && !entityplayer.inventory.addItemStackToInventory(filled)){
return false; return false;