Hose Pulley counts "flowing" blocks towards infinity threshold, can cause persistent server crash
Zincfox opened this issue · 3 comments
Describe the Bug
Hose pulley crashes the server when the source of the fluid can only be reached after visiting at least fluids.hosePulleyBlockThreshold
non-source blocks.
The resulting crash is persistent in that it occurs again once the hose-pulley is loaded, even resulting in crash-on-start when the offending chunk is chunk-loaded.
The "Reproduction Steps" show this for a threshold of 4
, but this can easily happen for the default value too if the "non-source"-pool is large enough (eg. draining the fluid of a chunk-hole made with a horizontal drill array from the bottom).
How to "fix" the persistent crash if it happens to you:
- Make a backup of your world! (seriously, the damage possibly caused by this "fix" is irreversible)
- Open
saves/<world>/serverconfig/forge-server.toml
, changeremoveErroringBlockEntities
totrue
2.1 This causes forge to delete all TileEntities which are causing errors, including our hose pulley - Load the world in Minecraft, visit/load the offending chunks
- Close minecraft, reset
removeErroringBlockEntities
tofalse
(prevent data-loss if something similar happens again)
Reproduction Steps
See screenshot for an example
- Set
fluids.hosePulleyBlockThreshold
to4
- Dig a 1 block wide and 6 blocks deep hole, place water at the top (1 source block and 5 flowing blocks)
- Place hose pulley above hole, lower to varying depths and attempt to pull fluid with pump
- Observed result if hose is lowered
x
blocks into the hole:
3.1x<=4
: Source block is consumed, pump extracts water ✔️
3.2x==5
: Source block is not consumed, pump extracts water --> Infinite⚠️
3.3x>=6
: Server crashes ❌
Expected Result
- the source block should be consumed for
x>=5
too or no fluid should be extracted (Only source blocks should be counted towardsfluids.hosePulleyBlockThreshold
) - the server should not crash for
x>=6
Screenshots and Videos
(This is the "Infinite" position from "Reproduction Steps")
Crash Report or Log
Operating System
Windows 10
Mod Version
0.5.0i
Minecraft Version
1.19.2
Forge Version
43.2.4
Other Mods
- JEI (11.6.0.1013)
Additional Context
Probably related to #4250 (exception type and location match)
Probably related code snippets:
- In FluidManipulationBehaviour.search#150:
visited.size() <= maxBlocks
compares count of all visited blocks (source and non-source) tomaxBlocks
loaded from config - In FluidDrainingBehaviour.continueSearch#280-288: While-Loop assumes that at least 1 source-block has been queued after visiting
maxBlocks
, causes (after multiple iterations, consuming the whole queue)NoSuchElementException
whenqueue
does in fact not contain any source blocks at this point.
I would further suggest clarifying the config-comment of hosePulleyBlockThreshold
to differentiate between source
and non-source
blocks. Previously to checking the code I incorrectly assumed that "number of fluid blocks" meant "number of source blocks", which made more sense from a balancing perspective.
It should further be noted that if only the crash is fixed but the non-source blocks still count towards the "infinity-limit" and the fluids extraction is allowed, most fluids could still be duplicated from one single bucket.