mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Use simulation distance for per-player mob spawns (#7247)
This commit is contained in:
parent
ffa0464d81
commit
fc1c86477e
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user