Program: 21781
Project: 21781
Buggy source:
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  TileEntity te=world.getTileEntity(x,y,z);
  boolean result=!world.isRemote;
  if (te != null && te instanceof IFluidHandler && !player.isSneaking() && !(te instanceof IInventory)) {
    if (stack.getItemDamage() != ElementEnum.heaviestMass) {
      int filled=0;
      for (int i=0; i < 6; i++) {
        filled=((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),new FluidStack(FluidHelper.elements.get(getElement(stack)),125),false);
        if (filled > 0) {
          if (result)           ((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),new FluidStack(FluidHelper.elements.get(getElement(stack)),125),true);
          if (!player.capabilities.isCreativeMode)           MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,ElementEnum.heaviestMass));
          return result;
        }
      }
    }
 else {
      FluidStack drained=null;
      Fluid fluid=MinechemUtil.getFluid((IFluidHandler)te);
      ElementEnum element=MinechemUtil.getElement(fluid);
      if (element != null) {
        for (int i=0; i < 6; i++) {
          drained=((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),false);
          if (drained != null && drained.amount > 0) {
            if (result)             ((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),true);
            if (!player.capabilities.isCreativeMode)             MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,element.ordinal()));
            return result;
          }
        }
      }
 else {
        MoleculeEnum molecule=MinechemUtil.getMolecule(fluid);
        if (molecule != null) {
          for (int i=0; i < 6; i++) {
            drained=((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),false);
            if (drained != null && drained.amount > 0) {
              if (result)               ((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),true);
              if (!player.capabilities.isCreativeMode)               MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.molecule,1,molecule.id()));
              return result;
            }
          }
        }
      }
    }
    return result;
  }
  return super.onItemUseFirst(stack,player,world,x,y,z,side,hitX,hitY,hitZ);
}

Fixed version (ground truth):
@Override public boolean onItemUseFirst(ItemStack stack,EntityPlayer player,World world,int x,int y,int z,int side,float hitX,float hitY,float hitZ){
  TileEntity te=world.getTileEntity(x,y,z);
  boolean result=!world.isRemote;
  if (te != null && te instanceof IFluidHandler && !player.isSneaking() && !(te instanceof IInventory)) {
    if (stack.getItemDamage() != ElementEnum.heaviestMass) {
      int filled=0;
      for (int i=0; i < 6; i++) {
        filled=((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),new FluidStack(FluidHelper.elements.get(getElement(stack)),125),false);
        if (filled > 0) {
          if (result)           ((IFluidHandler)te).fill(ForgeDirection.getOrientation(i),new FluidStack(FluidHelper.elements.get(getElement(stack)),125),true);
          if (!player.capabilities.isCreativeMode)           MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,ElementEnum.heaviestMass));
          return result;
        }
      }
    }
 else {
      FluidStack drained=null;
      Fluid fluid=MinechemUtil.getFluid((IFluidHandler)te);
      ElementEnum element=MinechemUtil.getElement(fluid);
      if (element != null) {
        for (int i=0; i < 6; i++) {
          drained=((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),false);
          if (drained != null && drained.amount > 0) {
            if (result)             ((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),true);
            if (!player.capabilities.isCreativeMode)             MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.element,1,element.ordinal()));
            return result;
          }
        }
      }
 else {
        MoleculeEnum molecule=MinechemUtil.getMolecule(fluid);
        if (fluid == FluidRegistry.WATER)         molecule=MoleculeEnum.water;
        if (molecule != null) {
          for (int i=0; i < 6; i++) {
            drained=((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),false);
            if (drained != null && drained.amount > 0) {
              if (result)               ((IFluidHandler)te).drain(ForgeDirection.getOrientation(i),new FluidStack(fluid,125),true);
              if (!player.capabilities.isCreativeMode)               MinechemUtil.incPlayerInventory(stack,-1,player,new ItemStack(MinechemItemsRegistration.molecule,1,molecule.id()));
              return result;
            }
          }
        }
      }
    }
    return result;
  }
  return super.onItemUseFirst(stack,player,world,x,y,z,side,hitX,hitY,hitZ);
}