Air Compressor ignores low-signal redstone rule after loading game
Opened this issue ยท 4 comments
Minecraft Version
1.16.5
Forge Version
36.1.6
Mod Versions
pneumaticcraft-repressurized-1.16.5-2.12.4-188 (discovered here)
pneumaticcraft-repressurized-1.16.5-2.12.5-190 (still a problem here)
Describe your problem, including steps to reproduce it
The Air Compressor's low-signal Redstone Behavior works as expected during the session in which it is configured. However, the redstone signal is ignored in the next session (quit and load again) under the following conditions:
- The Air Compressor is connected to its Pressure Gauge Tube Module with 5 blocks of redstone.
- The compressor has a high redstone signal causing it to power off.
- The compressor is not actively burning fuel.
Non-conditions:
- The tubing's destination. I have three Air Compressors that fire up when I load the game, and all three are connected to different objects.
- Other mods. I can reproduce this using only PNC:R and The One Probe for testing purposes.
After the second session loads, the compressor will begin burning fuel despite the high redstone signal. The compressor claims that there are "No Problems", i.e., no redstone signal to disable it.
First Session โ working fine:
Second Session โ No changes from first session, but redstone is ignored and it's now burning fuel:
Any other comments?
Thanks for all the work you've put into the mod.
I can reproduce the problem with the other compressors, with one obvious difference: their input redstone strengths update as the pressure increases, and the compressors sober up as a consequence. With the Air Compressor, the redstone strength is not changing because its pressure is already maxed. (I assume it's possible to rig up the other compressors this way also, it just didn't work out that way on my first try.)
It looks like RedstoneController.currentRedstonePower
is not saved with the compressor state. When the game loads, the value is 0. The compressor interprets that as "no redstone signal," and proceeds to start the compressor. The value is not updated until TileEntityBase.onNeighborBlockUpdate
is called, which won't happen if the input never changes. Since the Air Compressor was at max input, that call was never made and the redstone state was never synchronized.
Just spitballing here, but I wanted to put it out there to see what you think.
Thanks for the detailed analysis. I believe you're correct; I'll take a closer look at this tomorrow.
The redstone controller's current level shouldn't need to be saved - it's a dynamically calculated value. The bug is that's it's not properly reinitialised on first reload.