Program: 156734
Project: 156734
Buggy source:
@Override public boolean onBlockActivated(World world,int i,int j,int k,EntityPlayer entityplayer,int par6,float par7,float par8,float par9){
  if (super.onBlockActivated(world,i,j,k,entityplayer,par6,par7,par8,par9)) {
    return true;
  }
  ItemStack current=entityplayer.inventory.getCurrentItem();
  if (current != null) {
    TileEntity tile=world.getTileEntity(i,j,k);
    if (tile instanceof TileTank) {
      TileTank tank=(TileTank)tile;
      if (FluidContainerRegistry.isContainer(current)) {
        FluidStack liquid=FluidContainerRegistry.getFluidForFilledItem(current);
        if (liquid != null) {
          int qty=tank.fill(ForgeDirection.UNKNOWN,liquid,true);
          if (qty != 0 && !BuildCraftCore.debugWorldgen && !entityplayer.capabilities.isCreativeMode) {
            if (current.stackSize > 1) {
              if (!entityplayer.inventory.addItemStackToInventory(FluidContainerRegistry.drainFluidContainer(current))) {
                entityplayer.dropPlayerItemWithRandomChoice(FluidContainerRegistry.drainFluidContainer(current),false);
              }
              entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,InvUtils.consumeItem(current));
            }
 else {
              entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,FluidContainerRegistry.drainFluidContainer(current));
            }
          }
          return true;
        }
 else {
          FluidStack available=tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
          if (available != null) {
            ItemStack filled=FluidContainerRegistry.fillFluidContainer(available,current);
            liquid=FluidContainerRegistry.getFluidForFilledItem(filled);
            if (liquid != null) {
              if (!BuildCraftCore.debugWorldgen && !entityplayer.capabilities.isCreativeMode) {
                if (current.stackSize > 1) {
                  if (!entityplayer.inventory.addItemStackToInventory(filled)) {
                    return false;
                  }
 else {
                    entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,InvUtils.consumeItem(current));
                  }
                }
 else {
                  entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,InvUtils.consumeItem(current));
                  entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,filled);
                }
              }
              tank.drain(ForgeDirection.UNKNOWN,liquid.amount,true);
              return true;
            }
          }
        }
      }
 else       if (current.getItem() instanceof IFluidContainerItem) {
        if (current.stackSize != 1) {
          return false;
        }
        if (!world.isRemote) {
          IFluidContainerItem container=(IFluidContainerItem)current.getItem();
          FluidStack liquid=container.getFluid(current);
          FluidStack tankLiquid=tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
          boolean mustDrain=liquid == null || liquid.amount == 0;
          boolean mustFill=tankLiquid == null || tankLiquid.amount == 0;
          if (mustDrain && mustFill) {
          }
 else           if (mustDrain || !entityplayer.isSneaking()) {
            liquid=tank.drain(ForgeDirection.UNKNOWN,1000,false);
            int qtyToFill=container.fill(current,liquid,true);
            tank.drain(ForgeDirection.UNKNOWN,qtyToFill,true);
          }
 else           if (mustFill || entityplayer.isSneaking()) {
            if (liquid != null && liquid.amount > 0) {
              int qty=tank.fill(ForgeDirection.UNKNOWN,liquid,false);
              tank.fill(ForgeDirection.UNKNOWN,container.drain(current,qty,true),true);
            }
          }
        }
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean onBlockActivated(World world,int i,int j,int k,EntityPlayer entityplayer,int par6,float par7,float par8,float par9){
  if (super.onBlockActivated(world,i,j,k,entityplayer,par6,par7,par8,par9)) {
    return true;
  }
  ItemStack current=entityplayer.inventory.getCurrentItem();
  if (current != null) {
    TileEntity tile=world.getTileEntity(i,j,k);
    if (tile instanceof TileTank) {
      TileTank tank=(TileTank)tile;
      if (FluidContainerRegistry.isContainer(current)) {
        FluidStack liquid=FluidContainerRegistry.getFluidForFilledItem(current);
        if (liquid != null) {
          int qty=tank.fill(ForgeDirection.UNKNOWN,liquid,true);
          if (qty != 0 && !BuildCraftCore.debugWorldgen && !entityplayer.capabilities.isCreativeMode) {
            if (current.stackSize > 1) {
              if (!entityplayer.inventory.addItemStackToInventory(FluidContainerRegistry.drainFluidContainer(current))) {
                entityplayer.dropPlayerItemWithRandomChoice(FluidContainerRegistry.drainFluidContainer(current),false);
              }
              entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,InvUtils.consumeItem(current));
            }
 else {
              entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,FluidContainerRegistry.drainFluidContainer(current));
            }
          }
          return true;
        }
 else {
          FluidStack available=tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
          if (available != null) {
            ItemStack filled=FluidContainerRegistry.fillFluidContainer(available,current);
            liquid=FluidContainerRegistry.getFluidForFilledItem(filled);
            if (liquid != null) {
              if (!BuildCraftCore.debugWorldgen && !entityplayer.capabilities.isCreativeMode) {
                if (current.stackSize > 1) {
                  if (!entityplayer.inventory.addItemStackToInventory(filled)) {
                    return false;
                  }
 else {
                    entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,InvUtils.consumeItem(current));
                  }
                }
 else {
                  entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,InvUtils.consumeItem(current));
                  entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,filled);
                }
              }
              tank.drain(ForgeDirection.UNKNOWN,liquid.amount,true);
              return true;
            }
          }
        }
      }
 else       if (current.getItem() instanceof IFluidContainerItem) {
        if (current.stackSize != 1) {
          return false;
        }
        if (!world.isRemote) {
          IFluidContainerItem container=(IFluidContainerItem)current.getItem();
          FluidStack liquid=container.getFluid(current);
          FluidStack tankLiquid=tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid;
          boolean mustDrain=liquid == null || liquid.amount == 0;
          boolean mustFill=tankLiquid == null || tankLiquid.amount == 0;
          if (mustDrain && mustFill) {
          }
 else           if (mustDrain || !entityplayer.isSneaking()) {
            liquid=tank.drain(ForgeDirection.UNKNOWN,1000,false);
            int qtyToFill=container.fill(current,liquid,true);
            tank.drain(ForgeDirection.UNKNOWN,qtyToFill,true);
          }
 else           if (mustFill || entityplayer.isSneaking()) {
            if (liquid != null && liquid.amount > 0) {
              int qty=tank.fill(ForgeDirection.UNKNOWN,liquid,false);
              tank.fill(ForgeDirection.UNKNOWN,container.drain(current,qty,true),true);
            }
          }
        }
        return true;
      }
    }
  }
 else   if (DEBUG_MODE) {
    TileEntity tile=world.getTileEntity(i,j,k);
    if (tile instanceof TileTank) {
      TileTank tank=(TileTank)tile;
      if (tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid != null) {
        entityplayer.addChatComponentMessage(new ChatComponentText("String_Node_Str" + tank.getTankInfo(ForgeDirection.UNKNOWN)[0].fluid.amount + "String_Node_Str"));
      }
    }
  }
  return false;
}