From 8b28f9f564c76fb57c9b2b26e42119352ceffa73 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 26 Apr 2024 11:55:56 +0200 Subject: [PATCH] Fix accumulated total ticking chunks not being updated --- patches/server/0986-Rewrite-chunk-system.patch | 16 +++++++++++----- .../0993-Fix-World-isChunkGenerated-calls.patch | 2 +- .../0996-Optional-per-player-mob-spawns.patch | 2 +- ...lling-PreCreatureSpawnEvent-with-per-pl.patch | 2 +- ...distance-map-to-optimise-entity-tracker.patch | 2 +- .../1029-Optimise-chunk-tick-iteration.patch | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/patches/server/0986-Rewrite-chunk-system.patch b/patches/server/0986-Rewrite-chunk-system.patch index 8e9cb672a8..0e7e2bb36b 100644 --- a/patches/server/0986-Rewrite-chunk-system.patch +++ b/patches/server/0986-Rewrite-chunk-system.patch @@ -962,7 +962,7 @@ index 2f0d9b953802dee821cfde82d22b0567cce8ee91..22687667ec69a954261e55e59261286a public static Timing getTickList(ServerLevel worldserver, String timingsType) { diff --git a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java -index cff2f04409fab9abca87ceec85a551e1d59f9e7d..b1400f8bb661b13834c4176f94433435500113ba 100644 +index cff2f04409fab9abca87ceec85a551e1d59f9e7d..e3f56908cc8a9c3f4580def50fcfdc61bd495a71 100644 --- a/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java +++ b/src/main/java/io/papermc/paper/chunk/system/ChunkSystem.java @@ -32,192 +32,41 @@ public final class ChunkSystem { @@ -1167,7 +1167,7 @@ index cff2f04409fab9abca87ceec85a551e1d59f9e7d..b1400f8bb661b13834c4176f94433435 } public static boolean hasAnyChunkHolders(final ServerLevel level) { -@@ -244,26 +93,31 @@ public final class ChunkSystem { +@@ -244,26 +93,32 @@ public final class ChunkSystem { public static void onChunkBorder(final LevelChunk chunk, final ChunkHolder holder) { chunk.playerChunk = holder; @@ -1182,6 +1182,7 @@ index cff2f04409fab9abca87ceec85a551e1d59f9e7d..b1400f8bb661b13834c4176f94433435 public static void onChunkTicking(final LevelChunk chunk, final ChunkHolder holder) { chunk.level.getChunkSource().tickingChunks.add(chunk); + chunk.chunkStatus = net.minecraft.server.level.FullChunkStatus.BLOCK_TICKING; ++ chunk.level.chunkSource.chunkMap.tickingGenerated.incrementAndGet(); } public static void onChunkNotTicking(final LevelChunk chunk, final ChunkHolder holder) { @@ -1200,7 +1201,7 @@ index cff2f04409fab9abca87ceec85a551e1d59f9e7d..b1400f8bb661b13834c4176f94433435 } public static ChunkHolder getUnloadingChunkHolder(final ServerLevel level, final int chunkX, final int chunkZ) { -@@ -271,23 +125,15 @@ public final class ChunkSystem { +@@ -271,23 +126,15 @@ public final class ChunkSystem { } public static int getSendViewDistance(final ServerPlayer player) { @@ -16539,7 +16540,7 @@ index 88729d92878f98729eb5669cce5ae5b1418865a1..13d15a135dd0373bef4a5ac9ffb56dbb // Paper end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index d3f63185edd1db9fab3887ea3f08982435b3a23c..721b63f7471ace33ae22f4205f554ee3be0e033d 100644 +index d3f63185edd1db9fab3887ea3f08982435b3a23c..d6ecee1db17cb9eaeffa94b3d8dd150238fdefe5 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -122,10 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -16554,7 +16555,7 @@ index d3f63185edd1db9fab3887ea3f08982435b3a23c..721b63f7471ace33ae22f4205f554ee3 public final ServerLevel level; private final ThreadedLevelLightEngine lightEngine; public final BlockableEventLoop mainThreadExecutor; // Paper - public -@@ -134,11 +131,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -134,15 +131,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final ChunkGeneratorStructureState chunkGeneratorState; public final Supplier overworldDataStorage; private final PoiManager poiManager; @@ -16568,6 +16569,11 @@ index d3f63185edd1db9fab3887ea3f08982435b3a23c..721b63f7471ace33ae22f4205f554ee3 public final ChunkProgressListener progressListener; private final ChunkStatusUpdateListener chunkStatusListener; public final ChunkMap.ChunkDistanceManager distanceManager; +- private final AtomicInteger tickingGenerated; ++ public final AtomicInteger tickingGenerated; // Paper - public + private final String storageName; + private final PlayerMap playerMap; + public final Int2ObjectMap entityMap; @@ -150,28 +145,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private final Long2LongMap chunkSaveCooldowns; private final Queue unloadQueue; diff --git a/patches/server/0993-Fix-World-isChunkGenerated-calls.patch b/patches/server/0993-Fix-World-isChunkGenerated-calls.patch index e2cdbd6062..85cc5c81aa 100644 --- a/patches/server/0993-Fix-World-isChunkGenerated-calls.patch +++ b/patches/server/0993-Fix-World-isChunkGenerated-calls.patch @@ -8,7 +8,7 @@ This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 721b63f7471ace33ae22f4205f554ee3be0e033d..c22b40790a28c9a670538a8cc97821b33443845d 100644 +index d6ecee1db17cb9eaeffa94b3d8dd150238fdefe5..1d2d4d38ff3414896d07f7f4e40d0edb9a8c3993 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -735,9 +735,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0996-Optional-per-player-mob-spawns.patch b/patches/server/0996-Optional-per-player-mob-spawns.patch index 11bc946b57..b9fe80f3e4 100644 --- a/patches/server/0996-Optional-per-player-mob-spawns.patch +++ b/patches/server/0996-Optional-per-player-mob-spawns.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optional per player mob spawns diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c22b40790a28c9a670538a8cc97821b33443845d..79a3410833cb3f2d3a6429f821b524b89e152629 100644 +index 1d2d4d38ff3414896d07f7f4e40d0edb9a8c3993..56f855ed9dbbb9a7025bef6f9e98a8cdcf2ad4fc 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -291,9 +291,28 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0998-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/0998-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index 990f9615a7..12af227d2a 100644 --- a/patches/server/0998-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/patches/server/0998-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Improve cancelling PreCreatureSpawnEvent with per player mob diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 79a3410833cb3f2d3a6429f821b524b89e152629..2ae2f36ef3d78ee4859c09096d516eeb3ffb02a0 100644 +index 56f855ed9dbbb9a7025bef6f9e98a8cdcf2ad4fc..4621c33ed73b0db64e78e7b9be7013a2ba7393c8 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -309,8 +309,25 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/1006-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/1006-Use-distance-map-to-optimise-entity-tracker.patch index 9b3aea7b9e..22535d896b 100644 --- a/patches/server/1006-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/1006-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 2ae2f36ef3d78ee4859c09096d516eeb3ffb02a0..9bb56d235a7614cefcd0551a455f9c4ddadb1db0 100644 +index 4621c33ed73b0db64e78e7b9be7013a2ba7393c8..48f7997e8a20f5a5a77516cbde990d0aacc2078a 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -149,6 +149,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/1029-Optimise-chunk-tick-iteration.patch b/patches/server/1029-Optimise-chunk-tick-iteration.patch index 4f7003d529..1452dcd9c5 100644 --- a/patches/server/1029-Optimise-chunk-tick-iteration.patch +++ b/patches/server/1029-Optimise-chunk-tick-iteration.patch @@ -108,7 +108,7 @@ index 13d15a135dd0373bef4a5ac9ffb56dbbf53353a0..472b9494f8a34a8ba90d6a2936b0db75 List list; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 9bb56d235a7614cefcd0551a455f9c4ddadb1db0..39cf2abd9aacb5584467f6cde3d7b6e5b1912e96 100644 +index 48f7997e8a20f5a5a77516cbde990d0aacc2078a..dbe9df1e1973db133f7c8516256697ef7c968137 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -194,6 +194,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider