public static double discharge(ItemStack itemStack,double amount){
  if (itemStack != null) {
    if (itemStack.getItem() instanceof IEnergizedItem) {
      IEnergizedItem energizedItem=(IEnergizedItem)itemStack.getItem();
      if (energizedItem.canSend(itemStack)) {
        double energyToUse=Math.min(energizedItem.getMaxTransfer(itemStack),Math.min(energizedItem.getEnergy(itemStack),amount));
        energizedItem.setEnergy(itemStack,energizedItem.getEnergy(itemStack) - energyToUse);
        return energyToUse;
      }
    }
  }
  return 0;
}

public static double discharge ( ItemStack itemStack , double amount ) { if ( itemStack != null ) { if ( itemStack . getItem ( ) instanceof IEnergizedItem ) { IEnergizedItem energizedItem = ( IEnergizedItem ) itemStack . getItem ( ) ; if ( energizedItem . canSend ( itemStack ) ) { double energyToUse = Math . min ( energizedItem . getMaxTransfer ( itemStack ) , Math . min ( energizedItem . getEnergy ( itemStack ) , amount ) ) ; energizedItem . setEnergy ( itemStack , energizedItem . getEnergy ( itemStack ) - energyToUse ) ; return energyToUse ; } } } return 0 ; }
discharges an ienergizeditem with the defined amount of energy .
