diff --git a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch index 81a0e074e2..e65fb1db9d 100644 --- a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch @@ -121,7 +121,7 @@ tasks required to be executed by the chunk load task (i.e lighting and some poi tasks). diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index 27ce4a828e..30bafb214b 100644 +index fa1c920ea6..98acbfa44d 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -161,7 +161,7 @@ index 27ce4a828e..30bafb214b 100644 public static Timing getTickList(WorldServer worldserver, String timingsType) { diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index dbd1439970..6916ed30c4 100644 +index dbd1439970..f4836e2da1 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ @@ -177,62 +177,48 @@ index dbd1439970..6916ed30c4 100644 } + + public static boolean asyncChunks = false; -+ //public static boolean asyncChunkGeneration = true; // Leave out for now until we can control this -+ //public static boolean asyncChunkGenThreadPerWorld = true; // Leave out for now until we can control this -+ public static int asyncChunkLoadThreads = -1; + private static void asyncChunks() { ++ ConfigurationSection section; + if (version < 15) { + boolean enabled = config.getBoolean("settings.async-chunks", true); -+ ConfigurationSection section = config.createSection("settings.async-chunks"); ++ section = config.createSection("settings.async-chunks"); + section.set("enable", enabled); -+ section.set("load-threads", -1); -+ section.set("generation", true); -+ section.set("thread-per-world-generation", true); ++ section.set("threads", -1); ++ } else { ++ section = config.getConfigurationSection("settings.async-chunks"); ++ if (section == null) { ++ section = config.createSection("settings.async-chunks"); ++ } + } -+ -+ // TODO load threads now control async chunk save for unloading chunks, look into renaming this? ++ // Clean up old configs ++ if (section.contains("load-threads")) { ++ if (!section.contains("threads")) { ++ section.set("threads", section.get("load-threads")); ++ } ++ section.set("load-threads", null); ++ } ++ section.set("generation", null); ++ section.set("thread-per-world-generation", null); + + asyncChunks = getBoolean("settings.async-chunks.enable", true); -+ //asyncChunkGeneration = getBoolean("settings.async-chunks.generation", true); // Leave out for now until we can control this -+ //asyncChunkGenThreadPerWorld = getBoolean("settings.async-chunks.thread-per-world-generation", true); // Leave out for now until we can control this -+ asyncChunkLoadThreads = getInt("settings.async-chunks.load-threads", -1); -+ if (asyncChunkLoadThreads <= 0) { -+ asyncChunkLoadThreads = (int) Math.min(Integer.getInteger("paper.maxChunkThreads", 8), Math.max(1, Runtime.getRuntime().availableProcessors() - 1)); ++ int threads = getInt("settings.async-chunks.threads", -1); ++ if (threads <= 0) { ++ threads = (int) Math.min(Integer.getInteger("paper.maxChunkThreads", 8), Math.max(1, Runtime.getRuntime().availableProcessors() - 1)); + } + + // Let Shared Host set some limits -+ String sharedHostEnvGen = System.getenv("PAPER_ASYNC_CHUNKS_SHARED_HOST_GEN"); -+ String sharedHostEnvLoad = System.getenv("PAPER_ASYNC_CHUNKS_SHARED_HOST_LOAD"); -+ /* Ignore temporarily - we cannot control the gen threads (for now) -+ if ("1".equals(sharedHostEnvGen)) { -+ log("Async Chunks - Generation: Your host has requested to use a single thread world generation"); -+ asyncChunkGenThreadPerWorld = false; -+ } else if ("2".equals(sharedHostEnvGen)) { -+ log("Async Chunks - Generation: Your host has disabled async world generation - You will experience lag from world generation"); -+ asyncChunkGeneration = false; -+ } -+ */ -+ -+ if (sharedHostEnvLoad != null) { ++ String sharedHostThreads = System.getenv("PAPER_ASYNC_CHUNKS_SHARED_HOST_THREADS"); ++ if (sharedHostThreads != null) { + try { -+ asyncChunkLoadThreads = Math.max(1, Math.min(asyncChunkLoadThreads, Integer.parseInt(sharedHostEnvLoad))); ++ threads = Math.max(1, Math.min(threads, Integer.parseInt(sharedHostThreads))); + } catch (NumberFormatException ignored) {} + } + + if (!asyncChunks) { + log("Async Chunks: Disabled - Chunks will be managed synchronosuly, and will cause tremendous lag."); + } else { -+ ChunkTaskManager.initGlobalLoadThreads(asyncChunkLoadThreads); ++ ChunkTaskManager.initGlobalLoadThreads(threads); + log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag."); -+ /* Ignore temporarily - we cannot control the gen threads (for now) -+ if (!asyncChunkGeneration) { -+ log("Async Chunks - Generation: Disabled - Chunks will be generated synchronosuly, and will cause tremendous lag."); -+ } else if (asyncChunkGenThreadPerWorld) { -+ log("Async Chunks - Generation: Enabled - Chunks will be generated much faster, without lag."); -+ } else { -+ log("Async Chunks - Generation: Enabled (Single Thread) - Chunks will be generated much faster, without lag."); -+ } -+ */ + } + } } @@ -1583,7 +1569,7 @@ index 0000000000..ee906b594b +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java new file mode 100644 -index 0000000000..305da47868 +index 0000000000..ac9bc3e231 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java @@ -0,0 +0,0 @@ @@ -1675,7 +1661,7 @@ index 0000000000..305da47868 + + final PlayerChunkMap chunkManager = this.world.getChunkProvider().playerChunkMap; + -+ try (Timing ignored = this.world.timings.chunkIOStage1.startTimingIfSync()) { ++ try (Timing ignored = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { + final ChunkRegionLoader.InProgressChunkHolder chunkHolder; + + // apply fixes @@ -2399,7 +2385,7 @@ index 0000000000..2b20c159f6 + +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 5e4f3612ba..5b10562369 100644 +index 4c9c8e4839..259af7095c 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2548,10 +2534,10 @@ index 5e4f3612ba..5b10562369 100644 + this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); + com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); + // Paper end - this.world.timings.chunkAwait.startTiming(); // Paper + this.world.timings.syncChunkLoad.startTiming(); // Paper this.serverThreadQueue.awaitTasks(completablefuture::isDone); + com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug - this.world.timings.chunkAwait.stopTiming(); // Paper + this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2569,7 +2555,7 @@ index 5e4f3612ba..5b10562369 100644 } finally { playerChunkMap.callbackExecutor.run(); diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 8816c90e2d..1298a07dc7 100644 +index 79e85520f3..7389aba1a4 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; @@ -3113,7 +3099,7 @@ index f1620ba80e..74e6b8b973 100644 completablefuture = (CompletableFuture) this.statusFutures.get(i); if (completablefuture != null) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index b4c9d544fe..c4fb0c68dd 100644 +index 9c627bf3b4..19603343b2 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -3284,36 +3270,37 @@ index b4c9d544fe..c4fb0c68dd 100644 - return CompletableFuture.supplyAsync(() -> { + // Paper start - Async chunk io + final java.util.function.BiFunction> syncLoadComplete = (chunkHolder, ioThrowable) -> { - try (Timing ignored = this.world.timings.syncChunkLoadTimer.startTimingIfSync()) { // Paper + try (Timing ignored = this.world.timings.chunkLoad.startTimingIfSync()) { // Paper this.world.getMethodProfiler().c("chunkLoad"); - NBTTagCompound nbttagcompound; // Paper -- try (Timing ignored2 = this.world.timings.chunkIOStage1.startTimingIfSync()) { // Paper start - timings +- try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings - nbttagcompound = this.readChunkData(chunkcoordintpair); - } // Paper end - -- if (nbttagcompound != null) { +- if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings - boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); +- +- if (flag) { +- ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound); + if (ioThrowable != null) { + com.destroystokyo.paper.io.IOUtil.rethrow(ioThrowable); + } -- if (flag) { -- ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound); +- protochunk.setLastSaved(this.world.getTime()); +- return Either.left(protochunk); +- } + this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData); + chunkHolder.tasks.forEach(Runnable::run); + // Paper - async load completes this + // Paper end -- protochunk.setLastSaved(this.world.getTime()); -- return Either.left(protochunk); -- } -- - PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair); +- }} // Paper + // Paper start - This is done async + if (chunkHolder.protoChunk != null) { + chunkHolder.protoChunk.setLastSaved(this.world.getTime()); + return Either.left(chunkHolder.protoChunk); - } ++ } + // Paper end } catch (ReportedException reportedexception) { Throwable throwable = reportedexception.getCause(); diff --git a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch index 9e03baabbc..a83078a527 100644 --- a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch +++ b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch @@ -16,7 +16,7 @@ lots of chunks already. This massively reduces the lag spikes from sync chunk gens. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 98ce805a64..640265c3bd 100644 +index 747305619b..746b5b5589 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -48,7 +48,7 @@ index 98ce805a64..640265c3bd 100644 // Paper end @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug - this.world.timings.chunkAwait.stopTiming(); // Paper + this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper + PlayerChunk playerChunk = this.getChunk(ChunkCoordIntPair.pair(x, z)); + if (playerChunk != null) { @@ -197,7 +197,7 @@ index 04b97cec29..568fbbd5f2 100644 private void d(int i) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 90e4811157..0de3f6029c 100644 +index 63969e16aa..377676b94b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { diff --git a/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index a6d2a545d0..6628e1b2aa 100644 --- a/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -42,11 +42,11 @@ index 223d3b1125..37341d2d2e 100644 public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions"); public static final Timing connectionTimer = Timings.ofSafe("Connection Handler"); diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 6916ed30c4..1e186f149c 100644 +index f4836e2da1..a6107ba016 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - */ + log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag."); } } + @@ -56,7 +56,7 @@ index 6916ed30c4..1e186f149c 100644 + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 3d79e756d9..98ce805a64 100644 +index c457e3b772..747305619b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { diff --git a/Spigot-Server-Patches/Reduce-sync-loads.patch b/Spigot-Server-Patches/Reduce-sync-loads.patch index 536999d410..93926e3680 100644 --- a/Spigot-Server-Patches/Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/Reduce-sync-loads.patch @@ -268,7 +268,7 @@ index 0000000000..59aec10329 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 5b10562369..db0925f993 100644 +index 259af7095c..ea1117dc86 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -276,7 +276,7 @@ index 5b10562369..db0925f993 100644 com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end + com.destroystokyo.paper.io.SyncLoadFinder.logSyncLoad(this.world, x, z); // Paper - sync load info - this.world.timings.chunkAwait.startTiming(); // Paper + this.world.timings.syncChunkLoad.startTiming(); // Paper this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index 16530ea0ba..d625ed3f57 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -153,7 +153,7 @@ index 0000000000..223d3b1125 +} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 -index 0000000000..27ce4a828e +index 0000000000..fa1c920ea6 --- /dev/null +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ @@ -202,16 +202,12 @@ index 0000000000..27ce4a828e + public final Timing broadcastChunkUpdates; + public final Timing countNaturalMobs; + -+ public final Timing syncChunkLoadTimer; -+ public final Timing syncChunkLoadDataTimer; -+ public final Timing syncChunkLoadStructuresTimer; -+ public final Timing syncChunkLoadPostTimer; -+ public final Timing syncChunkLoadPopulateTimer; -+ public final Timing chunkAwait; ++ public final Timing chunkLoad; ++ public final Timing chunkLoadPopulate; ++ public final Timing syncChunkLoad; + public final Timing chunkLoadLevelTimer; -+ public final Timing chunkGeneration; -+ public final Timing chunkIOStage1; -+ public final Timing chunkIOStage2; ++ public final Timing chunkIO; ++ public final Timing chunkPostLoad; + public final Timing worldSave; + public final Timing worldSaveChunks; + public final Timing worldSaveLevel; @@ -248,16 +244,12 @@ index 0000000000..27ce4a828e + tileEntityTick = Timings.ofSafe(name + "tileEntityTick"); + tileEntityPending = Timings.ofSafe(name + "tileEntityPending"); + -+ syncChunkLoadTimer = Timings.ofSafe(name + "syncChunkLoad"); -+ syncChunkLoadDataTimer = Timings.ofSafe(name + "syncChunkLoad - Data"); -+ syncChunkLoadStructuresTimer = Timings.ofSafe(name + "chunkLoad - recreateStructures"); -+ syncChunkLoadPostTimer = Timings.ofSafe(name + "chunkLoad - Post"); -+ syncChunkLoadPopulateTimer = Timings.ofSafe(name + "chunkLoad - Populate"); -+ chunkAwait = Timings.ofSafe(name + "chunkAwait"); -+ chunkLoadLevelTimer = Timings.ofSafe(name + "chunkLoad - Load Level"); -+ chunkGeneration = Timings.ofSafe(name + "chunkGeneration"); -+ chunkIOStage1 = Timings.ofSafe(name + "ChunkIO Stage 1 - DiskIO"); -+ chunkIOStage2 = Timings.ofSafe(name + "ChunkIO Stage 2 - Post Load"); ++ chunkLoad = Timings.ofSafe(name + "Chunk Load"); ++ chunkLoadPopulate = Timings.ofSafe(name + "Chunk Load - Populate"); ++ syncChunkLoad = Timings.ofSafe(name + "Sync Chunk Load"); ++ chunkLoadLevelTimer = Timings.ofSafe(name + "Chunk Load - Load Level"); ++ chunkIO = Timings.ofSafe(name + "Chunk Load - DiskIO"); ++ chunkPostLoad = Timings.ofSafe(name + "Chunk Load - Post Load"); + worldSave = Timings.ofSafe(name + "World Save"); + worldSaveLevel = Timings.ofSafe(name + "World Save - Level"); + worldSaveChunks = Timings.ofSafe(name + "World Save - Chunks"); @@ -351,14 +343,14 @@ index cd72a9c845..5de881371a 100644 private final float frictionFactor; private final float f; diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 2b6fe2e01d..87c5e09a59 100644 +index 2b6fe2e01d..4cd353b253 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); if (this.needsDecoration) { -+ try (co.aikar.timings.Timing ignored = this.world.timings.syncChunkLoadPopulateTimer.startTiming()) { // Paper ++ try (co.aikar.timings.Timing ignored = this.world.timings.chunkLoadPopulate.startTiming()) { // Paper this.needsDecoration = false; java.util.Random random = new java.util.Random(); random.setSeed(world.getSeed()); @@ -371,7 +363,7 @@ index 2b6fe2e01d..87c5e09a59 100644 } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index ba2af2abe2..a653ce4ce5 100644 +index ba2af2abe2..875f353dc3 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -382,10 +374,10 @@ index ba2af2abe2..a653ce4ce5 100644 CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); + if (!completablefuture.isDone()) { // Paper -+ this.world.timings.chunkAwait.startTiming(); // Paper ++ this.world.timings.syncChunkLoad.startTiming(); // Paper this.serverThreadQueue.awaitTasks(completablefuture::isDone); - world.timings.syncChunkLoadTimer.stopTiming(); // Spigot -+ this.world.timings.chunkAwait.stopTiming(); // Paper ++ this.world.timings.syncChunkLoad.stopTiming(); // Paper + } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; @@ -468,7 +460,7 @@ index ba2af2abe2..a653ce4ce5 100644 @Override diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index e16d30f2ca..4af5a230ba 100644 +index e16d30f2ca..13d99de2cd 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ @@ -483,7 +475,6 @@ index e16d30f2ca..4af5a230ba 100644 NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); World world = chunk.getWorld(); - world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot -+ world.timings.chunkLoadLevelTimer.startTiming(); // Spigot for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); @@ -501,10 +492,10 @@ index e16d30f2ca..4af5a230ba 100644 } } - world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot -+ world.timings.chunkLoadLevelTimer.stopTiming(); // Paper - +- } + private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map map, Map map1) { diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java index 8d7a6d2403..707bd2600d 100644 --- a/src/main/java/net/minecraft/server/CustomFunction.java @@ -943,7 +934,7 @@ index b4a0bd7951..67bdd57747 100644 this.methodProfiler.exit(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 93d838ec2d..2a6955f855 100644 +index 93d838ec2d..5e31b65e16 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ @@ -961,16 +952,28 @@ index 93d838ec2d..2a6955f855 100644 private CompletableFuture> f(ChunkCoordIntPair chunkcoordintpair) { return CompletableFuture.supplyAsync(() -> { - try { -+ try (Timing ignored = this.world.timings.syncChunkLoadTimer.startTimingIfSync()) { // Paper ++ try (Timing ignored = this.world.timings.chunkLoad.startTimingIfSync()) { // Paper this.world.getMethodProfiler().c("chunkLoad"); - NBTTagCompound nbttagcompound = this.readChunkData(chunkcoordintpair); + NBTTagCompound nbttagcompound; // Paper -+ try (Timing ignored2 = this.world.timings.chunkIOStage1.startTimingIfSync()) { // Paper start - timings ++ try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings + nbttagcompound = this.readChunkData(chunkcoordintpair); + } // Paper end - if (nbttagcompound != null) { +- if (nbttagcompound != null) { ++ if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); + + if (flag) { +@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + + PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair); +- } ++ }} // Paper + } catch (ReportedException reportedexception) { + Throwable throwable = reportedexception.getCause(); + @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return "chunkGenerate " + chunkstatus.d(); }); @@ -984,7 +987,7 @@ index 93d838ec2d..2a6955f855 100644 ChunkStatus chunkstatus = PlayerChunk.getChunkStatus(playerchunk.getTicketLevel()); return !chunkstatus.b(ChunkStatus.FULL) ? PlayerChunk.UNLOADED_CHUNK_ACCESS : either.mapLeft((ichunkaccess) -> { -+ try (Timing ignored = world.timings.chunkIOStage2.startTimingIfSync()) { // Paper ++ try (Timing ignored = world.timings.chunkPostLoad.startTimingIfSync()) { // Paper ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); Chunk chunk; diff --git a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch index fd3ecd22b9..40af716755 100644 --- a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch @@ -5,7 +5,7 @@ Subject: [PATCH] implement optional per player mob spawns diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index 30bafb214b..c9a3ba4bfb 100644 +index 98acbfa44d..a94ebf7c76 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java @@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -545,7 +545,7 @@ index 0000000000..4f13d3ff83 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index db0925f993..29197d6c8d 100644 +index ea1117dc86..fe894a68bc 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { @@ -643,7 +643,7 @@ index 8427ee2ee8..0f04bcc8b7 100644 return this.bb; } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 7e5fa016c7..f564502f81 100644 +index 19603343b2..a7b981f299 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {