Changes of the `IAEPowerStorage.getPriority()` return value don't trigger resort of providers/requester in EnergyService
silenium-dev opened this issue ยท 0 comments
Describe the bug
The ObjectRBTreeSet
used in EnergyService
only balances its tree on insertion and removal. This causes priority changes to not be applied when the node is already registered.
How to reproduce the bug
Network:
- Dense Energy Cell (hard-coded priority:
1600
) - Energy Acceptor with an arbitrary external energy source that provides less than the maximum insertion rate of the Dense Energy Cell
- ME Chest (set priority before attaching to
2000
)
The priority of the ME Chest can be changed while in a network.
Because the initial priority is 2000
, all energy cells have a lower priority.
Now the ME Chest priority is changed to 0
, but the energy cell continues to be charged and the ME Chest stays empty, but online and usable.
When the BlockEntity
is recreated (e.g. server restart) the priority is loaded from NBT and correctly applied, which causes the ME Chest to now be charged first.
Expected behavior
When changing the priority to 0
, the ME Chest should be receiving energy before the Energy Cell continues to be charged.
Additional details
This is important for add-ons that provide additional energy storage blocks with configurable priority.
Which minecraft version are you using?
1.19
On which mod loaders does it happen?
Fabric
Crash log
https://gist.github.com/silenium-dev/3110476a87e6b186c12a0d64ae5d5e10