2022-02-22 23:28:34 +01:00
|
|
|
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
|
2024-10-31 22:30:18 +01:00
|
|
|
index df93afc35403db15aa8e09b7e36ca0bb630041eb..4cbb5fdcb8734d3944963b911bb759923ad38d16 100644
|
2022-02-22 23:28:34 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2024-10-31 22:30:18 +01:00
|
|
|
@@ -657,9 +657,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
2022-02-22 23:28:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
2024-01-18 18:52:00 +01:00
|
|
|
+ this.addLevel(world); // Paper - Put world into worldlist before initing the world; move up
|
2023-10-27 01:34:58 +02:00
|
|
|
this.initWorld(world, worlddata, this.worldData, worldoptions);
|
2022-02-22 23:28:34 +01:00
|
|
|
|
2022-08-14 10:03:13 +02:00
|
|
|
- this.addLevel(world);
|
2024-01-18 18:52:00 +01:00
|
|
|
+ // Paper - Put world into worldlist before initing the world; move up
|
2022-02-22 23:28:34 +01:00
|
|
|
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
|
Rework async chunk api implementation
Firstly, the old methods all routed to the CompletableFuture method.
However, the CF method could not guarantee that if the caller
was off-main that the future would be "completed" on-main. Since
the callback methods used the CF one, this meant that the callback
methods did not guarantee that the callbacks were to be called on
the main thread.
Now, all methods route to getChunkAtAsync(x, z, gen, urgent, cb)
so that the methods with the callback are guaranteed to invoke
the callback on the main thread. The CF behavior remains unchanged;
it may still appear to complete on main if invoked off-main.
Secondly, remove the scheduleOnMain invocation in the async
chunk completion. This unnecessarily delays the callback
by 1 tick.
Thirdly, add getChunksAtAsync(minX, minZ, maxX, maxZ, ...) which
will load chunks within an area. This method is provided as a helper
as keeping all chunks loaded within an area can be complicated to
implement for plugins (due to the lacking ticket API), and is
already implemented internally anyways.
Fourthly, remove the ticket addition that occured with getChunkAt
and getChunkAtAsync. The ticket addition may delay the unloading
of the chunk unnecessarily. It also fixes a very rare timing bug
where the future/callback would be completed after the chunk
unloads.
2024-11-19 07:34:32 +01:00
|
|
|
index 72f8d3a89396f9289f5b451b24cc181e7ac3222e..75bd9617164c63a641602bf772a5e0f15a322c7e 100644
|
2022-02-22 23:28:34 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
2024-10-27 18:11:15 +01:00
|
|
|
@@ -1336,10 +1336,11 @@ public final class CraftServer implements Server {
|
2022-02-22 23:28:34 +01:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-01-18 18:52:00 +01:00
|
|
|
+ this.console.addLevel(internal); // Paper - Put world into worldlist before initing the world; move up
|
2022-12-07 22:35:34 +01:00
|
|
|
this.console.initWorld(internal, worlddata, worlddata, worlddata.worldGenOptions());
|
2022-02-22 23:28:34 +01:00
|
|
|
|
2024-10-23 22:52:43 +02:00
|
|
|
internal.setSpawnSettings(true);
|
2022-08-14 10:03:13 +02:00
|
|
|
- this.console.addLevel(internal);
|
2024-01-18 18:52:00 +01:00
|
|
|
+ // Paper - Put world into worldlist before initing the world; move up
|
2022-02-22 23:28:34 +01:00
|
|
|
|
|
|
|
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
|
2024-01-24 15:57:53 +01:00
|
|
|
internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API
|