Slightly improve logic for charge distribution by short circuiting to not bother inserting/attempting to use at all if the item is full
@@ -83,8 +83,11 @@ public class ModuleChargeDistributionUnit extends ModuleMekaSuit {
IStrictEnergyHandler handler = EnergyCompatUtils.getStrictEnergyHandler(stack);
if (handler != null) {
FloatingLong remaining = handler.insertEnergy(amount, Action.SIMULATE);
+ if (remaining.smallerThan(amount)) {
+ //If we can actually insert any energy into
return handler.insertEnergy(useEnergy(player, amount.subtract(remaining)), Action.EXECUTE).add(remaining);
}
+ }
return amount;
}
}
\ No newline at end of file
