simplexterrain
simplexterrain copied to clipboard
(Hopefully) Fix the setupSpawn server crash
Currently, dedicated servers will deadlock when generating a new simplex world for the first time. While commit 68e91f displays a walkaround for this, restarting the server does not seem to fix the issue. After a bit of digging, I figured out why exactly this crash occurs:
On dedicated servers, SimplexChunkGenerator is constructed in (Mixin
)GeneratorOptions#fromProperties
. This construction, however, occurs before fabric initalizes the mod, since server properties are loaded right after parsing the command line. Because of that, the first time the SimplexChunkGenerator
constructor is invoked, there aren't any noiseModifiers
or postProcessors
to init. Singleplayer luckily doesn't have this issue.
To fix it, I just seperated the Processer/Modifier init logic into a seperate function SimplexChunkGenerator#init
, which is called in both the constructor as well as in MixinMinecraftServer#fixDumbServerCrash
. This ensures that noiseModifiers
is populated when SimplexChunkGenerator#getHeight
is called.
...... holy shit you're a genius.
Please let me know if I stuffed up that merge commit in any way