-
Notifications
You must be signed in to change notification settings - Fork 85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
increaseStoredEnergyUnits(X, false)
is an "atomic" operation. You either add X amount of energy or you don't. No half-add-half-waste is ever done. Making it increase in one go will cause much greater waste when dynamo stored energy is near its capacity.
Yeah but i don't see the difference between using the loop or to do it in a single operation, given we don't even use the boolean returned to check if the energy has successfully been added to the hatch. So my understanding is that you'd waste the energy the same way with the loop, as the |
There is a difference when you have 2packets of free space, but want to inject 4 packets. |
Sure, but i don't see any logic done by the Multi to check for room before injecting to the hatch, it seems to assume the power is always considered injected by the multi no matter what, all it does it to track down how many power was added to one hatch so it can properly distribute the power to the other hatches. But in the end, if there is some power left, it's discarded, so you lose this power in the end? And the amount of amps to add to a hatch is computed the same way in both the old code and new code, so if power is discarded, it's discarded the same way, we just avoid spam calling the method to add the energy. So i don't understand your point. |
assume there is 2.5 packet worth of space, and we need to add 4 packet before makes 4 attempts # 1: added 1 packet total: added 2 packet after make 1 attemp total: nothing |
the code used in @Override
public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) {
if (!canAccessData()) return false;
if (getStoredEU() < getEUCapacity() || aIgnoreTooMuchEnergy) {
setStoredEU(mMetaTileEntity.getEUVar() + aEnergy);
return true;
}
return false;
} We pass it with |
fixes GTNewHorizons/GT-New-Horizons-Modpack#15746
I couldn't see any obvious reason that could cause the multies to break, but i'm no expert in this part of the code.