Paper/patches/server/0748-Put-world-into-worldlist-before-initing-the-world.patch

42 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 22 Feb 2022 14:21:35 -0800
Subject: [PATCH] Put world into worldlist before initing the world
Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d5ee1f01bbe38dffb91c12d0d60477cafea3b4bb..a9060243cc9231af2b0e2783eb87131d458f4275 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -635,9 +635,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
+ this.addLevel(world); // Paper - Put world into worldlist before initing the world; move up
this.initWorld(world, worlddata, this.worldData, worldoptions);
- this.addLevel(world);
+ // Paper - Put world into worldlist before initing the world; move up
this.getPlayerList().addWorldborderListener(world);
if (worlddata.getCustomBossEvents() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 63c0ea96f67eb7a8a05fc63ecc50d49f19a0e444..2049b78d91addb93ffd5322abf1621a91a25d468 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1288,10 +1288,11 @@ public final class CraftServer implements Server {
return null;
}
+ this.console.addLevel(internal); // Paper - Put world into worldlist before initing the world; move up
this.console.initWorld(internal, worlddata, worlddata, worlddata.worldGenOptions());
internal.setSpawnSettings(true, true);
- this.console.addLevel(internal);
+ // Paper - Put world into worldlist before initing the world; move up
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
//internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API // Paper - rewrite chunk system