From 8e9459eadc9094348216e4ed3582430c7fc079ac Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 10 May 2020 23:31:36 -0400 Subject: [PATCH] Fix missing flag pass for isUrgent --- ...90-Asynchronous-chunk-IO-and-loading.patch | 26 +++++++++++++++---- ...ement-optional-per-player-mob-spawns.patch | 6 ++--- ...hunkMap-memory-use-for-visibleChunks.patch | 4 +-- ...asks-Speed-up-processing-of-chunk-lo.patch | 14 +++++----- ...Priority-Urgency-System-for-World-Ge.patch | 23 +++------------- 5 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch index 9f1b4b8ce9..0003b7490e 100644 --- a/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch @@ -2305,7 +2305,7 @@ index 0000000000000000000000000000000000000000..2b20c159f6bb425be70201cf33159aa9 + +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 4c9c8e483974f8869d6711626620cfd7d814d956..cabe2a5908dd9ee721c13c1825e65a37f72361d4 100644 +index 4c9c8e483974f8869d6711626620cfd7d814d956..5f91b311f3512233c3c21563832afbb408b20bde 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -299,11 +299,136 @@ public class ChunkProviderServer extends IChunkProvider { @@ -2406,7 +2406,7 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..cabe2a5908dd9ee721c13c1825e65a37 + } + + private CompletableFuture> bringToStatusAsync(int x, int z, ChunkCoordIntPair chunkPos, ChunkStatus status, boolean isUrgent) { -+ CompletableFuture> future = this.getChunkFutureMainThread(x, z, status, true); ++ CompletableFuture> future = this.getChunkFutureMainThread(x, z, status, true, isUrgent); + Long identifier = Long.valueOf(this.asyncLoadSeqCounter++); + int ticketLevel = MCUtil.getTicketLevelFor(status); + this.addTicketAtLevel(TicketType.ASYNC_LOAD, chunkPos, ticketLevel, identifier); @@ -2445,8 +2445,12 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..cabe2a5908dd9ee721c13c1825e65a37 if (Thread.currentThread() != this.serverThread) { return (IChunkAccess) CompletableFuture.supplyAsync(() -> { return this.getChunkAt(i, j, chunkstatus, flag); -@@ -329,8 +454,13 @@ public class ChunkProviderServer extends IChunkProvider { - CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); +@@ -326,11 +451,16 @@ public class ChunkProviderServer extends IChunkProvider { + } + + gameprofilerfiller.c("getChunkCacheMiss"); +- CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); ++ CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag, true); // Paper if (!completablefuture.isDone()) { // Paper + // Paper start - async chunk io/loading @@ -2459,7 +2463,19 @@ index 4c9c8e483974f8869d6711626620cfd7d814d956..cabe2a5908dd9ee721c13c1825e65a37 this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -835,11 +965,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -396,6 +526,11 @@ public class ChunkProviderServer extends IChunkProvider { + } + + private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { ++ // Paper start - add isUrgent - old sig left in place for dirty nms plugins ++ return getChunkFutureMainThread(i, j, chunkstatus, flag, false); ++ } ++ private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag, boolean isUrgent) { ++ // Paper end + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); + long k = chunkcoordintpair.pair(); + int l = 33 + ChunkStatus.a(chunkstatus); +@@ -835,11 +970,12 @@ public class ChunkProviderServer extends IChunkProvider { protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task try { diff --git a/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch index f3c718b0fd..6eedef1099 100644 --- a/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch @@ -545,10 +545,10 @@ index 0000000000000000000000000000000000000000..4f13d3ff8391793a99f067189f854078 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 61640d814426732a03d8bb3394c2cd3414a27a6c..cbaf14b24b3d941f0912788c87c3eab5aad7f5f0 100644 +index a77b756fdfe404d364823daa90f005cfc5d09f20..bdd5060851ea553f1a0b56c8f8e95208b8dfd757 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -740,7 +740,22 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -745,7 +745,22 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); @@ -572,7 +572,7 @@ index 61640d814426732a03d8bb3394c2cd3414a27a6c..cbaf14b24b3d941f0912788c87c3eab5 this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings this.world.getMethodProfiler().exit(); -@@ -808,8 +823,23 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -813,8 +828,23 @@ public class ChunkProviderServer extends IChunkProvider { if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) { int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits diff --git a/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index a26715bc15..49a29d43ff 100644 --- a/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..e0ad725b2e63ffd329fc4725d15290cb + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index b4cf530bdf1027ef27a1aec40ac4fade8d8275de..e03e6465655e209563eed2313502786fa2361024 100644 +index 7da40ea2fbc1aace8ca9fd8556501ad580efd240..1ee69b5c657feb468ec2834536c2cd178e0526f3 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -749,7 +749,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -754,7 +754,7 @@ public class ChunkProviderServer extends IChunkProvider { entityPlayer.playerNaturallySpawnedEvent.callEvent(); }; // Paper end diff --git a/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index 1032ebca72..7d78cef22d 100644 --- a/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/Spigot-Server-Patches/0459-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -56,10 +56,10 @@ index 647f6fc8efb350fbd0bc4c40358a998f8b89b96a..9f1662ece533f5ea744662b718e2d89a + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index e03e6465655e209563eed2313502786fa2361024..21cf5ac6c38968c45bdd0f09f60743ad216cd925 100644 +index 1ee69b5c657feb468ec2834536c2cd178e0526f3..3cda1c4fad1bd2c2220bd8b23964f556c8747f0b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -682,6 +682,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -687,6 +687,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().enter("purge"); this.world.timings.doChunkMap.startTiming(); // Spigot this.chunkMapDistance.purgeTickets(); @@ -67,7 +67,7 @@ index e03e6465655e209563eed2313502786fa2361024..21cf5ac6c38968c45bdd0f09f60743ad this.tickDistanceManager(); this.world.timings.doChunkMap.stopTiming(); // Spigot this.world.getMethodProfiler().exitEnter("chunks"); -@@ -691,6 +692,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -696,6 +697,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.doChunkUnload.startTiming(); // Spigot this.world.getMethodProfiler().exitEnter("unload"); this.playerChunkMap.unloadChunks(booleansupplier); @@ -75,7 +75,7 @@ index e03e6465655e209563eed2313502786fa2361024..21cf5ac6c38968c45bdd0f09f60743ad this.world.timings.doChunkUnload.stopTiming(); // Spigot this.world.getMethodProfiler().exit(); this.clearCache(); -@@ -749,7 +751,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -754,7 +756,7 @@ public class ChunkProviderServer extends IChunkProvider { entityPlayer.playerNaturallySpawnedEvent.callEvent(); }; // Paper end @@ -84,7 +84,7 @@ index e03e6465655e209563eed2313502786fa2361024..21cf5ac6c38968c45bdd0f09f60743ad Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); if (optional.isPresent()) { -@@ -832,6 +834,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -837,6 +839,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.chunkTicks.startTiming(); // Spigot // Paper this.world.a(chunk, k); this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper @@ -92,7 +92,7 @@ index e03e6465655e209563eed2313502786fa2361024..21cf5ac6c38968c45bdd0f09f60743ad } } }); -@@ -973,6 +976,41 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -978,6 +981,41 @@ public class ChunkProviderServer extends IChunkProvider { super.executeTask(runnable); } @@ -226,7 +226,7 @@ index 77adc64e30cbc1d4542eb8f4a446788c1fdc61be..3c25436f158316d2e09cbf4673365edd // Spigot Start CrashReport crashreport; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index e37900348d57ff7253224238d9f9975626db9fa0..2676093bf1084ff2b905759aa09e1f1f22fd5660 100644 +index 3979f151f067a62e45211c9f11e47e36dbe16b31..83fb6f71d2ce4e3a2a2750c953cfc1f1ef5e88ec 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -432,6 +432,7 @@ public class WorldServer extends World { diff --git a/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch b/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch index 52d27f8ef4..74708610a6 100644 --- a/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch +++ b/Spigot-Server-Patches/0463-Implement-Chunk-Priority-Urgency-System-for-World-Ge.patch @@ -16,15 +16,10 @@ 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 21cf5ac6c38968c45bdd0f09f60743ad216cd925..fb315503b0aad2cb52cb70b5b033d33fcecd1d22 100644 +index 3cda1c4fad1bd2c2220bd8b23964f556c8747f0b..ca94bd901b266e722bb22e8662e6cd8dfbfef35b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -464,10 +464,14 @@ public class ChunkProviderServer extends IChunkProvider { - } - - gameprofilerfiller.c("getChunkCacheMiss"); -- CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); -+ CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag, true); // Paper +@@ -468,6 +468,10 @@ public class ChunkProviderServer extends IChunkProvider { if (!completablefuture.isDone()) { // Paper // Paper start - async chunk io/loading @@ -46,19 +41,7 @@ index 21cf5ac6c38968c45bdd0f09f60743ad216cd925..fb315503b0aad2cb52cb70b5b033d33f ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -508,6 +516,11 @@ public class ChunkProviderServer extends IChunkProvider { - } - - private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { -+ // Paper start -+ return getChunkFutureMainThread(i, j, chunkstatus, flag, false); -+ } -+ private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag, boolean isUrgent) { -+ // Paper end - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); - long k = chunkcoordintpair.pair(); - int l = 33 + ChunkStatus.a(chunkstatus); -@@ -535,6 +548,11 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -540,6 +548,11 @@ public class ChunkProviderServer extends IChunkProvider { } } }