Program: 21807
Project: 21807
Buggy source:
private ItemStack emptyTube(ItemStack itemStack,EntityPlayer player,World world,int x,int y,int z){
  if (!world.isAirBlock(x,y,z) && !world.getBlock(x,y,z).getMaterial().isSolid()) {
    Block sourceBlock=world.getBlock(x,y,z);
    int metadata=world.getBlockMetadata(x,y,z);
    sourceBlock.harvestBlock(world,player,x,y,z,metadata);
    sourceBlock.breakBlock(world,x,y,z,sourceBlock,metadata);
    world.setBlockToAir(x,y,z);
  }
  if (world.isAirBlock(x,y,z)) {
    Block block=FluidHelper.elementsBlocks.get(FluidHelper.elements.get(getElement(itemStack)));
    world.setBlock(x,y,z,block,0,3);
    RadiationEnum radioactivity=ElementEnum.elements.get(itemStack.getItemDamage()).radioactivity();
    TileEntity tile=world.getTileEntity(x,y,z);
    if (radioactivity != RadiationEnum.stable && tile instanceof RadiationFluidTileEntity) {
      ((RadiationFluidTileEntity)tile).info=getRadiationInfo(itemStack,world);
    }
    if (player.capabilities.isCreativeMode) {
      return itemStack;
    }
 else {
      MinechemUtil.incPlayerInventory(itemStack,-8,player,new ItemStack(MinechemItemsRegistration.element,8,ElementEnum.heaviestMass));
    }
  }
  return itemStack;
}

Fixed version (ground truth):
private ItemStack emptyTube(ItemStack itemStack,EntityPlayer player,World world,int x,int y,int z){
  if (!world.isAirBlock(x,y,z) && !world.getBlock(x,y,z).getMaterial().isSolid()) {
    Block sourceBlock=world.getBlock(x,y,z);
    int metadata=world.getBlockMetadata(x,y,z);
    sourceBlock.harvestBlock(world,player,x,y,z,metadata);
    sourceBlock.breakBlock(world,x,y,z,sourceBlock,metadata);
    world.setBlockToAir(x,y,z);
  }
  if (world.isAirBlock(x,y,z)) {
    RadiationEnum radioactivity=ElementEnum.elements.get(itemStack.getItemDamage()).radioactivity();
    if (!player.capabilities.isCreativeMode) {
      if (itemStack.stackSize >= 8) {
        itemStack.stackSize-=8;
      }
 else {
        int needs=8 - itemStack.stackSize;
        itemStack.stackSize=0;
        Set<ItemStack> otherItemsStacks=MinechemUtil.findItemStacks(player.inventory,itemStack.getItem(),itemStack.getItemDamage());
        otherItemsStacks.remove(itemStack);
        int free=0;
        Iterator<ItemStack> it2=otherItemsStacks.iterator();
        while (it2.hasNext()) {
          ItemStack stack=it2.next();
          free+=stack.stackSize;
        }
        if (free < needs) {
          return itemStack;
        }
        Iterator<ItemStack> it=otherItemsStacks.iterator();
        while (it.hasNext()) {
          ItemStack stack=it.next();
          RadiationEnum anotherRadiation=getRadioactivity(stack);
          if (anotherRadiation.getLife() < radioactivity.getLife()) {
            radioactivity=anotherRadiation;
          }
          if (stack.stackSize >= needs) {
            stack.stackSize-=needs;
            needs=0;
            break;
          }
 else {
            needs-=stack.stackSize;
            stack.stackSize=0;
          }
        }
      }
      ItemStack empties=MinechemUtil.addItemToInventory(player.inventory,new ItemStack(MinechemItemsRegistration.element,8,ElementEnum.heaviestMass));
      MinechemUtil.throwItemStack(world,empties,x,y,z);
    }
    Block block=FluidHelper.elementsBlocks.get(FluidHelper.elements.get(getElement(itemStack)));
    world.setBlock(x,y,z,block,0,3);
    TileEntity tile=world.getTileEntity(x,y,z);
    if (radioactivity != RadiationEnum.stable && tile instanceof RadiationFluidTileEntity) {
      ((RadiationFluidTileEntity)tile).info=getRadiationInfo(itemStack,world);
    }
  }
  return itemStack;
}