Battery block does not notify neighboring comparators when power level changes
CplPibald opened this issue ยท 0 comments
SilentMechanisms-1.16.3-1.0.1+77
silent-lib-1.16.3-4.9.6
Forge 36.1.0
Repro steps
- Connect a comparator to a battery box. Note output redstone level
- Charge or discharge the battery box to change its power level
Expected Behavior
Redstone level from comparator updates as charge in battery box changes
Actual Behavior
Output redstone level does not update with changes to battery level. If you give the comparator a block update event (switch redstone manually, move or change a nearby block, etc), then the redstone value suddenly jumps to the correct level.
Analysis
I'm not sure how other mods/block do it, but it seems like the comparator only changes its redstone state when it receives a block update event. Minecraft sends these automatically when a blockstate changes, but the power level of a battery box is stored in the TE, and not in the blockstate. The battery box needs to trigger a block update in the comparator when the level changes sufficiently to change the redstone level. The easy way to do this is to send updateNeighbors()
each tick the battery level changes, but I don't know if that would be too much for performance.