mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
67 lines
2.7 KiB
Diff
67 lines
2.7 KiB
Diff
From a576811cfbd84b86003b6d81569f8e4399447a10 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
|
|
|
|
removes Mineshaft loading legacy as we had pre 1.13.2 to avoid managing
|
|
that very large data file from legacy systems.
|
|
|
|
Previous to 1.13.2 these data files were never loaded to begin with, so they
|
|
effectively do not contain valid/relevant data.
|
|
|
|
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 00e9a17355..153809432c 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldPersistentData.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java
|
|
@@ -26,6 +26,7 @@ public class WorldPersistentData {
|
|
this.c = datafixer;
|
|
this.d = file;
|
|
}
|
|
+ private static final PersistentBase NO_RESULT = new ForcedChunk(); // Paper
|
|
|
|
private File a(String s) {
|
|
return new File(this.d, s + ".dat");
|
|
@@ -46,14 +47,17 @@ public class WorldPersistentData {
|
|
|
|
@Nullable
|
|
public <T extends PersistentBase> T b(Supplier<T> supplier, String s) {
|
|
+ if ("Mineshaft_index".equals(s) || "Mineshaft".equals(s)) return null; // Paper - mineshaft is useless data
|
|
T persistentbase = (T) this.data.get(s); // Paper - decompile fix
|
|
|
|
if (persistentbase == null && !this.data.containsKey(s)) {
|
|
persistentbase = this.c(supplier, s);
|
|
this.data.put(s, persistentbase);
|
|
+ } else { // Paper
|
|
+ this.data.put(s, NO_RESULT); // Paper
|
|
}
|
|
|
|
- return persistentbase;
|
|
+ return persistentbase == NO_RESULT ? null : persistentbase; // Paper
|
|
}
|
|
|
|
@Nullable
|
|
@@ -66,7 +70,7 @@ public class WorldPersistentData {
|
|
NBTTagCompound nbttagcompound = this.a(s, SharedConstants.a().getWorldVersion());
|
|
|
|
t0.a(nbttagcompound.getCompound("data"));
|
|
- return t0;
|
|
+ return t0 == NO_RESULT ? null : t0; // Paper
|
|
}
|
|
} catch (Exception exception) {
|
|
WorldPersistentData.LOGGER.error("Error loading saved data: {}", s, exception);
|
|
@@ -80,6 +84,7 @@ public class WorldPersistentData {
|
|
}
|
|
|
|
public NBTTagCompound a(String s, int i) throws IOException {
|
|
+ if ("Mineshaft".equals(s) || "Mineshaft_index".equals(s)) return new NBTTagCompound(); // Paper
|
|
File file = this.a(s);
|
|
PushbackInputStream pushbackinputstream = new PushbackInputStream(new FileInputStream(file), 2);
|
|
Throwable throwable = null;
|
|
--
|
|
2.22.0
|
|
|