Needed for items that can not be charged at all, or can be charged only in a special way (crafting, inside special block(s)/machine(s) that know how to do it, etc.).
Code
public interface IElectricItem {
...
/**
* Determine if the item can be charged.
*
* @return Whether the item can be charged.
*/
boolean canBeCharged();
...
}
It should be checked at the beginning of ElectricItem.charge() and if returns false, ElectricItem.charge() should not charge the item.
Code
public final class ElectricItem {
...
public static int charge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) {
...
if ( ((IElectricItem) itemStack.getItem()).canBeCharged() == false ) return 0;
...rest code...
}
...
}
Additional idea: SU-Battery can be rewritten in such a way to be discharged smoothly, like RE-Battery, but not be able to recharge. Empty batteries can be thrown away or placed into recycler.