Use simulation distance for per-player mob spawns (#7247)
This commit is contained in:
parent
503ac8f1cb
commit
d3f3429d03
3 changed files with 25 additions and 8 deletions
|
@ -592,8 +592,25 @@ index 0c82b270c7095c7e4666a8078ecc7142503795c4..0583d7ee24f694fbf5138dfae9f7b8c8
|
|||
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 f0dac1f596911eb2109192ef16a619f8ae71d1f7..07b616d9d7cde77c001f5c627daef0731d883e61 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
@@ -323,6 +323,12 @@ 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 7b391d6ab84eeaed7bdd27ea70d5e3f9690a0abf..17a36ee61aacfc41e2d926335c460350cd25ab42 100644
|
||||
index 7b391d6ab84eeaed7bdd27ea70d5e3f9690a0abf..d9405456f61b954f9b6fa2fa7939fc3a36ec6fc6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -916,7 +916,22 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
@ -606,7 +623,7 @@ index 7b391d6ab84eeaed7bdd27ea70d5e3f9690a0abf..17a36ee61aacfc41e2d926335c460350
|
|||
+ 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue