@Override public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) { ItemStack current = entityplayer.inventory.getCurrentItem(); if (current != null) { int liquidId = LiquidManager.getLiquidIDForFilledItem(current); TileTank tank = (TileTank) world.getBlockTileEntity(i, j, k); if (liquidId != 0) { int qty = tank.fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, true); if (qty != 0 && !BuildCraftCore.debugMode) { entityplayer.inventory.setInventorySlotContents( entityplayer.inventory.currentItem, Utils.consumeItem(current)); } return true; } else { ItemStack filled = LiquidManager.fillLiquidContainer(tank.getLiquidId(), current); int qty = tank.empty(BuildCraftAPI.BUCKET_VOLUME, false); if (filled != null && qty >= BuildCraftAPI.BUCKET_VOLUME) { if (current.stackSize > 1 && !entityplayer.inventory.addItemStackToInventory(filled)) { return false; } entityplayer.inventory.setInventorySlotContents( entityplayer.inventory.currentItem, Utils.consumeItem(current)); tank.empty(BuildCraftAPI.BUCKET_VOLUME, true); return true; } } } return false; }
@Override public void update() { super.update(); ItemStack itemInInventory = tile.getStackInSlot(0); if (itemInInventory != null) { int liquidId = BuildCraftAPI.getLiquidForFilledItem(itemInInventory); if (liquidId != 0) { if (fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, false) == BuildCraftAPI.BUCKET_VOLUME) { fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, true); tile.setInventorySlotContents(0, Utils.consumeItem(itemInInventory)); } } } if (heat > COOLANT_THRESHOLD) { int extraHeat = heat - COOLANT_THRESHOLD; if (coolantQty > extraHeat) { coolantQty -= extraHeat; heat = COOLANT_THRESHOLD; } else { heat -= coolantQty; coolantQty = 0; } } if (heat > 0 && (penatlyCooling > 0 || !tile.isRedstonePowered)) { heat -= 10; } if (heat <= 0 && penatlyCooling > 0) { penatlyCooling--; } }