simplexterrain icon indicating copy to clipboard operation
simplexterrain copied to clipboard

(Hopefully) Fix the setupSpawn server crash

Open Arc-blroth opened this issue 4 years ago • 2 comments

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.

Arc-blroth avatar Aug 03 '20 02:08 Arc-blroth

...... holy shit you're a genius.

jaskarth avatar Aug 03 '20 02:08 jaskarth

Please let me know if I stuffed up that merge commit in any way

valoeghese avatar May 13 '21 06:05 valoeghese