{
ItemStack current = entityplayer.inventory.getCurrentItem();
if (current != null)
{
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(i, j, k);
if (liquid != null)
{
int amount = logic.fill(ForgeDirection.UNKNOWN, liquid, false);
if (amount == liquid.amount)
{
logic.fill(ForgeDirection.UNKNOWN, liquid, true);
if (!entityplayer.capabilities.isCreativeMode)
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, consumeItem(current));
return true;
}
else
return true;
}
else if (FluidContainerRegistry.isBucket(current))
{
FluidTankInfo[] tanks = logic.getTankInfo(ForgeDirection.UNKNOWN);
FluidStack fillFluid = tanks[0].fluid;// getFluid();
ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, current);
if (fillStack != null)
{
logic.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.getFluidForFilledItem(fillStack).amount, true);
if (!entityplayer.capabilities.isCreativeMode)
{
if (current.stackSize == 1)
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, fillStack);