Negative energy capacity for network of universal cables
djpadbit opened this issue ยท 6 comments
Issue description:
When too many universal cable are placed, the capacity of the energy network goes negative and no energy can flow through.
Steps to reproduce:
- Place down 6710 ultimate universal cables (I used worldedit)
- Place down one more cable and the capacity of the network becomes negative
Versions:
Forge: 14.23.5.2836
Mekanism: 9.8.0.381
From what i've seen, i think the problem is here.
The calculated capacity of the network isn't clamped to the int that it uses. And if i use
MekanismUtils.clampToInt
to clamp it, the problem is fixed (I don't think it's the right function to use though since this is in the api).I do agree this is a problem, but not due to the lack of clamping. The EnergyNetwork actually uses doubles for energy. (Though I do agree it should not wrap back over from overflowing or there may be issues for pressurized tubes and mechanical pipes)
This will be "fixed' in 9.8.1. Probably won't have a chance to do a proper fix and make EnergyNetwork support up to double for capacity by 9.8.1 given the changes were a bit more in depth than I realized; however, I did add some code to make sure the capacity doesn't overflow to the negatives.
Alright, it wasn't a big bug anyways and realistically speaking nobody is going to have 6710 ultimate universal cables (i hope at least).
Ya that is why I am not bothering to rush to get a fix for making the EnergyNetwork a double in capacity. Though I did think fixing the overflow was important especially due the individual pipe capacities being able to be changed via the config.
Scratch that, it probably will make it into 9.8.1 given I got a bit distracted and it ended up not actually being that hard given the data type for capacities in the config is an integer so I don't have to make quite as many places support it as a double.
Fix included in 9.8.1