diff --git a/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch index 21c552920a..8e9de01dc6 100644 --- a/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch +++ b/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch @@ -247,7 +247,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.tickingTicketsTracker.removeTicket(TicketType.PLAYER, chunkcoordintpair, this.getPlayerTicketLevel(), chunkcoordintpair); } @@ -0,0 +0,0 @@ public abstract class DistanceManager { - } + // Paper end public int getNaturalSpawnChunkCount() { - this.naturalSpawnChunkCounter.runAllUpdates(); diff --git a/patches/server/Skip-distance-map-update-when-spawning-disabled.patch b/patches/server/Skip-distance-map-update-when-spawning-disabled.patch index de4673a7e0..4b8e873a8c 100644 --- a/patches/server/Skip-distance-map-update-when-spawning-disabled.patch +++ b/patches/server/Skip-distance-map-update-when-spawning-disabled.patch @@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ((this.spawnFriendlies || this.spawnEnemies) && this.chunkMap.playerMobDistanceMap != null) { // don't update when animals and monsters are disabled // update distance map this.level.timings.playerMobDistanceMapUpdate.startTiming(); - this.chunkMap.playerMobDistanceMap.update(this.level.players, this.chunkMap.viewDistance); + this.chunkMap.playerMobDistanceMap.update(this.level.players, this.distanceManager.getSimulationDistance()); diff --git a/patches/server/implement-optional-per-player-mob-spawns.patch b/patches/server/implement-optional-per-player-mob-spawns.patch index 8900600d83..d2f573dfa4 100644 --- a/patches/server/implement-optional-per-player-mob-spawns.patch +++ b/patches/server/implement-optional-per-player-mob-spawns.patch @@ -592,6 +592,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { double d0 = (double) SectionPos.sectionToBlockCoord(pos.x, 8); double d1 = (double) SectionPos.sectionToBlockCoord(pos.z, 8); +diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/DistanceManager.java ++++ b/src/main/java/net/minecraft/server/level/DistanceManager.java +@@ -0,0 +0,0 @@ public abstract class DistanceManager { + + } + ++ // Paper start ++ public int getSimulationDistance() { ++ return this.simulationDistance; ++ } ++ // Paper end ++ + public int getNaturalSpawnChunkCount() { + this.naturalSpawnChunkCounter.runAllUpdates(); + return this.naturalSpawnChunkCounter.chunks.size(); diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -606,7 +623,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.chunkMap.playerMobDistanceMap != null) { + // update distance map + this.level.timings.playerMobDistanceMapUpdate.startTiming(); -+ this.chunkMap.playerMobDistanceMap.update(this.level.players, this.chunkMap.viewDistance); ++ this.chunkMap.playerMobDistanceMap.update(this.level.players, this.distanceManager.getSimulationDistance()); + this.level.timings.playerMobDistanceMapUpdate.stopTiming(); + // re-set mob counts + for (ServerPlayer player : this.level.players) {