Fix dims on servers not loading the first run (#7445)

This commit is contained in:
Cyborgmas 2020-11-11 04:09:35 -05:00 committed by GitHub
parent bca20ace4e
commit 0ff8a596fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,16 @@
SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath()); SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath());
SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s); SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s);
MinecraftServer.func_240777_a_(saveformat$levelsave); MinecraftServer.func_240777_a_(saveformat$levelsave);
@@ -169,6 +176,7 @@ @@ -142,6 +149,8 @@
dimensiongeneratorsettings = optionset.has(optionspec3) ? serverproperties.field_241082_U_.func_236230_k_() : serverproperties.field_241082_U_;
}
+ // Forge: Deserialize the DimensionGeneratorSettings to ensure modded dims are loaded on first server load (see SimpleRegistryCodec#decode). Vanilla behaviour only loads from the server.properties and deserializes only after the 2nd server load.
+ dimensiongeneratorsettings = DimensionGeneratorSettings.field_236201_a_.encodeStart(worldsettingsimport, dimensiongeneratorsettings).flatMap(nbt -> DimensionGeneratorSettings.field_236201_a_.parse(worldsettingsimport, nbt)).getOrThrow(false, errorMsg->{});
iserverconfiguration = new ServerWorldInfo(worldsettings, dimensiongeneratorsettings, Lifecycle.stable());
}
@@ -169,6 +178,7 @@
Thread thread = new Thread("Server Shutdown Thread") { Thread thread = new Thread("Server Shutdown Thread") {
public void run() { public void run() {
dedicatedserver.func_71263_m(true); dedicatedserver.func_71263_m(true);