Fix PersistentStructureLegacy NPE on custom worlds

This is caused due to the DimensionManager in CB worlds not being
registered by NMS, we fix this by copying CBs behavior of using the
world providers DimensionManager, vs using the actual dimension manager
of the world
This commit is contained in:
Shane Freeder 2019-03-29 11:37:20 +00:00
parent f4f4396f0e
commit 761d6ae72e

View File

@ -1,4 +1,4 @@
From b5f9f16cf0a99f16d1749a3982d87ea482fd7099 Mon Sep 17 00:00:00 2001
From 56239b2abe648882c297d69867015b4831b5a347 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 29 Mar 2019 01:25:11 -0400
Subject: [PATCH] Optimize Persistent Data Loading
@ -14,7 +14,7 @@ These files take a long time to convert on large worlds and crashes the server.
Additionally, cache the result of a file being missing so we don't keep spam checking it.
diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java
index 8d51af286..e86d382c8 100644
index 8d51af2867..e86d382c8d 100644
--- a/src/main/java/net/minecraft/server/WorldPersistentData.java
+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java
@@ -39,6 +39,7 @@ public class WorldPersistentData {
@ -51,6 +51,19 @@ index 8d51af286..e86d382c8 100644
File file = idatamanager.getDataFile(dimensionmanager, s);
FileInputStream fileinputstream = new FileInputStream(file);
Throwable throwable = null;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 5c2421ac38..ee071ba2f6 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -80,7 +80,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
this.P();
this.Q();
this.getWorldBorder().a(minecraftserver.au());
- MCUtil.scheduleAsyncTask(() -> this.getChunkProvider().chunkLoader.getPersistentStructureLegacy(dimensionmanager, worldMaps)); // Paper
+ MCUtil.scheduleAsyncTask(() -> this.getChunkProvider().chunkLoader.getPersistentStructureLegacy(worldProvider.getDimensionManager(), worldMaps)); // Paper
}
public WorldServer i_() {
--
2.21.0