mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 13:57:35 +01:00
2 patch
This commit is contained in:
parent
0670cfd66f
commit
4fb248cd77
@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||||
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
||||||
long lastAutoSaveTime; // Paper - incremental autosave
|
}
|
||||||
long inactiveTimeStart; // Paper - incremental autosave
|
// Paper end
|
||||||
|
|
||||||
+ // Paper start - optimise isOutsideOfRange
|
+ // Paper start - optimise isOutsideOfRange
|
||||||
+ // cached here to avoid a map lookup
|
+ // cached here to avoid a map lookup
|
||||||
@ -25,17 +25,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end - optimise isOutsideOfRange
|
+ // Paper end - optimise isOutsideOfRange
|
||||||
+
|
+
|
||||||
public ChunkHolder(ChunkPos pos, int level, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
|
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
|
||||||
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
|
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
|
||||||
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
|
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||||
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
||||||
this.queueLevel = this.oldTicketLevel;
|
|
||||||
this.setTicketLevel(level);
|
this.setTicketLevel(level);
|
||||||
|
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
|
||||||
this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
|
this.chunkMap = (ChunkMap)playersWatchingChunkProvider; // Paper
|
||||||
+ this.updateRanges(); // Paper - optimise isOutsideOfRange
|
+ this.updateRanges(); // Paper - optimise isOutsideOfRange
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paper start
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
@ -63,11 +63,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
// Paper end - use distance map to optimise entity tracker
|
// Paper end - use distance map to optimise entity tracker
|
||||||
+ // Paper start - optimise PlayerChunkMap#isOutsideRange
|
+ // Paper start - optimise PlayerChunkMap#isOutsideRange
|
||||||
|
+ this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
||||||
|
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||||
|
+ // Paper start - optimise PlayerChunkMap#isOutsideRange
|
||||||
+ this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
+ this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
||||||
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
|
int effectiveTickViewDistance = this.getEffectiveViewDistance();
|
||||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
this.playerEntityTrackerTrackMaps[i].remove(player);
|
this.playerEntityTrackerTrackMaps[i].remove(player);
|
||||||
}
|
}
|
||||||
@ -76,9 +79,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.playerMobSpawnMap.remove(player);
|
+ this.playerMobSpawnMap.remove(player);
|
||||||
+ this.playerChunkTickRangeMap.remove(player);
|
+ this.playerChunkTickRangeMap.remove(player);
|
||||||
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
|
this.playerViewDistanceBroadcastMap.remove(player);
|
||||||
void updateMaps(ServerPlayer player) {
|
this.playerViewDistanceTickMap.remove(player);
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
||||||
}
|
}
|
||||||
@ -86,18 +89,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - optimise PlayerChunkMap#isOutsideRange
|
+ // Paper start - optimise PlayerChunkMap#isOutsideRange
|
||||||
+ this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
+ this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE);
|
||||||
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
// Paper end
|
int effectiveTickViewDistance = this.getEffectiveViewDistance();
|
||||||
|
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
this.worldgenMailbox = this.queueSorter.getProcessor(threadedmailbox, false);
|
|
||||||
this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false);
|
this.mainThreadMailbox = this.queueSorter.getProcessor(mailbox, false);
|
||||||
|
this.mailboxLight = this.queueSorter.getProcessor(lightthreaded, false);// Paper
|
||||||
this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false));
|
this.lightEngine = new ThreadedLevelLightEngine(chunkProvider, this, this.level.dimensionType().hasSkyLight(), threadedmailbox1, this.queueSorter.getProcessor(threadedmailbox1, false));
|
||||||
- this.distanceManager = new ChunkMap.ChunkDistanceManager(workerExecutor, mainThreadExecutor);
|
- this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor);
|
||||||
+ this.distanceManager = new ChunkMap.ChunkDistanceManager(workerExecutor, mainThreadExecutor); this.distanceManager.chunkMap = this; // Paper
|
+ this.distanceManager = new ChunkMap.ChunkDistanceManager(executor, mainThreadExecutor); this.distanceManager.chunkMap = this; // Paper
|
||||||
this.overworldDataStorage = supplier;
|
this.overworldDataStorage = persistentStateManagerFactory;
|
||||||
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, flag, this.level); // Paper
|
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
|
||||||
this.setViewDistance(i);
|
this.setViewDistance(viewDistance);
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
|
this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
|
||||||
}
|
}
|
||||||
@ -134,17 +137,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ });
|
+ });
|
||||||
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
+ // Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
|
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
|
||||||
public void updatePlayerMobTypeMap(Entity entity) {
|
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
||||||
return entityPlayer.mobCounts[enumCreatureType.ordinal()];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ private static double getDistanceSquaredFromChunk(ChunkPos chunkPos, Entity entity) { return euclideanDistanceSquared(chunkPos, entity); } // Paper - OBFHELPER
|
|
||||||
private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) {
|
|
||||||
double d0 = (double) (pos.x * 16 + 8);
|
|
||||||
double d1 = (double) (pos.z * 16 + 8);
|
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
} else {
|
} else {
|
||||||
if (holder != null) {
|
if (holder != null) {
|
||||||
@ -154,45 +149,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
if (holder != null) {
|
if (holder != null) {
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
return isOutsideOfRange(chunkcoordintpair, false);
|
return this.isOutsideOfRange(chunkPos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
- boolean isOutsideOfRange(ChunkPos chunkcoordintpair, boolean reducedRange) {
|
- boolean isOutsideOfRange(ChunkPos chunkcoordintpair, boolean reducedRange) {
|
||||||
- int chunkRange = level.spigotConfig.mobSpawnRange;
|
- int chunkRange = level.spigotConfig.mobSpawnRange;
|
||||||
- chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
|
- chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
|
||||||
- chunkRange = (chunkRange > 8) ? 8 : chunkRange;
|
- chunkRange = (chunkRange > 8) ? 8 : chunkRange;
|
||||||
+ // Paper start - optimise isOutsideOfRange
|
-
|
||||||
+ final boolean isOutsideOfRange(ChunkPos chunkcoordintpair, boolean reducedRange) {
|
|
||||||
+ return this.isOutsideOfRange(this.getUpdatingChunkIfPresent(chunkcoordintpair.toLong()), chunkcoordintpair, reducedRange);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- final int finalChunkRange = chunkRange; // Paper for lambda below
|
- final int finalChunkRange = chunkRange; // Paper for lambda below
|
||||||
- //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
|
- //double blockRange = (reducedRange) ? Math.pow(chunkRange << 4, 2) : 16384.0D; // Paper - use from event
|
||||||
- // Spigot end
|
- // Spigot end
|
||||||
- long i = chunkcoordintpair.toLong();
|
- long i = chunkcoordintpair.toLong();
|
||||||
|
+ // Paper start - optimise isOutsideOfRange
|
||||||
|
+ final boolean isOutsideOfRange(ChunkPos chunkcoordintpair, boolean reducedRange) {
|
||||||
|
+ return this.isOutsideOfRange(this.getUpdatingChunkIfPresent(chunkcoordintpair.toLong()), chunkcoordintpair, reducedRange);
|
||||||
|
+ }
|
||||||
+ final boolean isOutsideOfRange(ChunkHolder playerchunk, ChunkPos chunkcoordintpair, boolean reducedRange) {
|
+ final boolean isOutsideOfRange(ChunkHolder playerchunk, ChunkPos chunkcoordintpair, boolean reducedRange) {
|
||||||
+ // this function is so hot that removing the map lookup call can have an order of magnitude impact on its performance
|
+ // this function is so hot that removing the map lookup call can have an order of magnitude impact on its performance
|
||||||
+ // tested and confirmed via System.nanoTime()
|
+ // tested and confirmed via System.nanoTime()
|
||||||
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInRange = reducedRange ? playerchunk.playersInMobSpawnRange : playerchunk.playersInChunkTickRange;
|
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInRange = reducedRange ? playerchunk.playersInMobSpawnRange : playerchunk.playersInChunkTickRange;
|
||||||
|
+ if (playersInRange == null) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ Object[] backingSet = playersInRange.getBackingSet();
|
||||||
|
|
||||||
- return !this.distanceManager.hasPlayersNearby(i) ? true : this.playerMap.a(i).noneMatch((entityplayer) -> {
|
- return !this.distanceManager.hasPlayersNearby(i) ? true : this.playerMap.getPlayers(i).noneMatch((entityplayer) -> {
|
||||||
- // Paper start -
|
- // Paper start - add PlayerNaturallySpawnCreaturesEvent
|
||||||
- com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
|
- com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
|
||||||
- double blockRange = 16384.0D;
|
- double blockRange = 16384.0D;
|
||||||
- if (reducedRange) {
|
- if (reducedRange) {
|
||||||
- event = entityplayer.playerNaturallySpawnedEvent;
|
- event = entityplayer.playerNaturallySpawnedEvent;
|
||||||
- if (event == null || event.isCancelled()) return false;
|
- if (event == null || event.isCancelled()) return false;
|
||||||
- blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
|
- blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
|
||||||
- }
|
|
||||||
+ if (playersInRange == null) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- return (!entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange); // Spigot
|
|
||||||
- // Paper end
|
|
||||||
- });
|
|
||||||
+ Object[] backingSet = playersInRange.getBackingSet();
|
|
||||||
+
|
|
||||||
+ if (reducedRange) {
|
+ if (reducedRange) {
|
||||||
+ for (int i = 0, len = backingSet.length; i < len; ++i) {
|
+ for (int i = 0, len = backingSet.length; i < len; ++i) {
|
||||||
+ Object raw = backingSet[i];
|
+ Object raw = backingSet[i];
|
||||||
@ -201,10 +190,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ ServerPlayer player = (ServerPlayer) raw;
|
+ ServerPlayer player = (ServerPlayer) raw;
|
||||||
+ // don't check spectator and whatnot, already handled by mob spawn map update
|
+ // don't check spectator and whatnot, already handled by mob spawn map update
|
||||||
+ if (player.lastEntitySpawnRadiusSquared > getDistanceSquaredFromChunk(chunkcoordintpair, player)) {
|
+ if (player.lastEntitySpawnRadiusSquared > euclideanDistanceSquared(chunkcoordintpair, player)) {
|
||||||
+ return false; // in range
|
+ return false; // in range
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
|
- // Paper end
|
||||||
|
- return !entityplayer.isSpectator() && ChunkMap.euclideanDistanceSquared(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
||||||
|
- });
|
||||||
+ } else {
|
+ } else {
|
||||||
+ final double range = (DistanceManager.MOB_SPAWN_RANGE * 16) * (DistanceManager.MOB_SPAWN_RANGE * 16);
|
+ final double range = (DistanceManager.MOB_SPAWN_RANGE * 16) * (DistanceManager.MOB_SPAWN_RANGE * 16);
|
||||||
+ // before spigot, mob spawn range was actually mob spawn range + tick range, but it was split
|
+ // before spigot, mob spawn range was actually mob spawn range + tick range, but it was split
|
||||||
@ -215,7 +207,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ ServerPlayer player = (ServerPlayer) raw;
|
+ ServerPlayer player = (ServerPlayer) raw;
|
||||||
+ // don't check spectator and whatnot, already handled by mob spawn map update
|
+ // don't check spectator and whatnot, already handled by mob spawn map update
|
||||||
+ if (range > getDistanceSquaredFromChunk(chunkcoordintpair, player)) {
|
+ if (range > euclideanDistanceSquared(chunkcoordintpair, player)) {
|
||||||
+ return false; // in range
|
+ return false; // in range
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -232,7 +224,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||||
+++ b/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 {
|
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
||||||
private final Long2ObjectMap<ObjectSet<ServerPlayer>> playersPerChunk = new Long2ObjectOpenHashMap();
|
final Long2ObjectMap<ObjectSet<ServerPlayer>> playersPerChunk = new Long2ObjectOpenHashMap();
|
||||||
public final Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> tickets = new Long2ObjectOpenHashMap();
|
public final Long2ObjectOpenHashMap<SortedArraySet<Ticket<?>>> tickets = new Long2ObjectOpenHashMap();
|
||||||
private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker();
|
private final DistanceManager.ChunkTicketTracker ticketTracker = new DistanceManager.ChunkTicketTracker();
|
||||||
- private final DistanceManager.FixedPlayerDistanceChunkTracker naturalSpawnChunkCounter = new DistanceManager.FixedPlayerDistanceChunkTracker(8);
|
- private final DistanceManager.FixedPlayerDistanceChunkTracker naturalSpawnChunkCounter = new DistanceManager.FixedPlayerDistanceChunkTracker(8);
|
||||||
@ -241,18 +233,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// Paper start use a queue, but still keep unique requirement
|
// Paper start use a queue, but still keep unique requirement
|
||||||
public final java.util.Queue<ChunkHolder> pendingChunkUpdates = new java.util.ArrayDeque<ChunkHolder>() {
|
public final java.util.Queue<ChunkHolder> pendingChunkUpdates = new java.util.ArrayDeque<ChunkHolder>() {
|
||||||
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
||||||
private final Executor mainThreadExecutor;
|
final Executor mainThreadExecutor;
|
||||||
private long ticketTickCounter;
|
private long ticketTickCounter;
|
||||||
|
|
||||||
+ ChunkMap chunkMap; // Paper
|
+ ChunkMap chunkMap; // Paper
|
||||||
+
|
+
|
||||||
protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
|
protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
|
||||||
mainThreadExecutor.getClass();
|
Objects.requireNonNull(mainThreadExecutor);
|
||||||
ProcessorHandle<Runnable> mailbox = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute);
|
ProcessorHandle<Runnable> mailbox = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute);
|
||||||
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
@@ -0,0 +0,0 @@ public abstract class DistanceManager {
|
||||||
protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k);
|
protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k);
|
||||||
|
|
||||||
public boolean runAllUpdates(ChunkMap chunkStorage) {
|
public boolean runAllUpdates(ChunkMap playerchunkmap) {
|
||||||
- this.naturalSpawnChunkCounter.runAllUpdates();
|
- this.naturalSpawnChunkCounter.runAllUpdates();
|
||||||
+ //this.f.a(); // Paper - no longer used
|
+ //this.f.a(); // Paper - no longer used
|
||||||
this.playerTicketManager.runAllUpdates();
|
this.playerTicketManager.runAllUpdates();
|
||||||
@ -303,7 +295,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !level.players().isEmpty(); // CraftBukkit
|
boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
+ // Paper start - optimize isOutisdeRange
|
+ // Paper start - optimize isOutisdeRange
|
||||||
@ -358,27 +350,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
final int[] chunksTicked = {0}; this.chunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping
|
final int[] chunksTicked = {0}; this.chunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping
|
||||||
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
|
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
|
||||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||||
LevelChunk chunk = (LevelChunk) optional1.get();
|
this.level.getProfiler().pop();
|
||||||
ChunkPos chunkcoordintpair = playerchunk.getPos();
|
ChunkPos chunkcoordintpair = chunk.getPos();
|
||||||
|
|
||||||
- if (!this.chunkMap.noPlayersCloseForSpawning(chunkcoordintpair)) {
|
- if (this.level.isPositionEntityTicking(chunkcoordintpair) && !this.chunkMap.noPlayersCloseForSpawning(chunkcoordintpair)) {
|
||||||
+ if (!this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange
|
+ if (this.level.isPositionEntityTicking(chunkcoordintpair) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange
|
||||||
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
|
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
|
||||||
- if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
|
- if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot
|
||||||
+ if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange
|
+ if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange
|
||||||
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
|
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
|
||||||
|
if (chunksTicked[0]++ % 10 == 0) this.level.getServer().midTickLoadChunks(); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||||
|
// CraftBukkit end
|
||||||
|
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||||
|
|
||||||
|
+ public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
||||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||||
|
boolean needsChunkCenterUpdate; // Paper - no-tick view distance
|
||||||
|
|
||||||
+ double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks
|
|
||||||
+
|
|
||||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ServerPlayerGameMode interactionManager) {
|
|
||||||
super(world, world.getSpawn(), world.getSharedSpawnAngle(), profile);
|
|
||||||
this.respawnDimension = Level.OVERWORLD;
|
|
@ -27,12 +27,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.server.MCUtil;
|
import net.minecraft.server.MCUtil;
|
||||||
+import net.minecraft.server.MinecraftServer;
|
+import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||||
|
import net.minecraft.server.network.ServerPlayerConnection;
|
||||||
import net.minecraft.util.CsvOutput;
|
import net.minecraft.util.CsvOutput;
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceTickMap;
|
||||||
// Paper start - distance maps
|
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerViewDistanceNoTickMap;
|
||||||
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
|
// Paper end - no-tick view distance
|
||||||
+ // Paper start - use distance map to optimise tracker
|
+ // Paper start - use distance map to optimise tracker
|
||||||
+ public static boolean isLegacyTrackingEntity(Entity entity) {
|
+ public static boolean isLegacyTrackingEntity(Entity entity) {
|
||||||
+ return entity.isLegacyTrackingEntity;
|
+ return entity.isLegacyTrackingEntity;
|
||||||
@ -60,6 +60,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
+ trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - use distance map to optimise entity tracker
|
+ // Paper end - use distance map to optimise entity tracker
|
||||||
|
// Paper start - no-tick view distance
|
||||||
|
int effectiveTickViewDistance = this.getEffectiveViewDistance();
|
||||||
|
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
|
||||||
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||||
@ -69,9 +73,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.playerEntityTrackerTrackMaps[i].remove(player);
|
+ this.playerEntityTrackerTrackMaps[i].remove(player);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - use distance map to optimise tracker
|
+ // Paper end - use distance map to optimise tracker
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
|
this.playerViewDistanceBroadcastMap.remove(player);
|
||||||
void updateMaps(ServerPlayer player) {
|
this.playerViewDistanceTickMap.remove(player);
|
||||||
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
int chunkX = MCUtil.getChunkCoordinate(player.getX());
|
||||||
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
|
||||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||||
@ -83,12 +88,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
+ trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance()));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - use distance map to optimise entity tracker
|
+ // Paper end - use distance map to optimise entity tracker
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
// Paper end
|
int effectiveTickViewDistance = this.getEffectiveViewDistance();
|
||||||
|
int effectiveNoTickViewDistance = Math.max(this.getEffectiveNoTickViewDistance(), effectiveTickViewDistance);
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, flag, this.level); // Paper
|
this.poiManager = new PoiManager(new File(this.storageFolder, "poi"), dataFixer, dsync, world);
|
||||||
this.setViewDistance(i);
|
this.setViewDistance(viewDistance);
|
||||||
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
|
this.playerMobDistanceMap = this.level.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper
|
||||||
+ // Paper start - use distance map to optimise entity tracker
|
+ // Paper start - use distance map to optimise entity tracker
|
||||||
+ this.playerEntityTrackerTrackMaps = new com.destroystokyo.paper.util.misc.PlayerAreaMap[TRACKING_RANGE_TYPES.length];
|
+ this.playerEntityTrackerTrackMaps = new com.destroystokyo.paper.util.misc.PlayerAreaMap[TRACKING_RANGE_TYPES.length];
|
||||||
@ -129,9 +134,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
|
+ this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - use distance map to optimise entity tracker
|
+ // Paper end - use distance map to optimise entity tracker
|
||||||
}
|
// Paper start - no-tick view distance
|
||||||
|
this.setNoTickViewDistance(this.level.paperConfig.noTickViewDistance);
|
||||||
public void updatePlayerMobTypeMap(Entity entity) {
|
this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- }
|
- }
|
||||||
+ // Paper - delay this logic for the entity tracker tick, no need to duplicate it
|
+ // Paper - delay this logic for the entity tracker tick, no need to duplicate it
|
||||||
|
|
||||||
int i = Mth.floor(player.getX()) >> 4;
|
int i = SectionPos.blockToSectionCoord(player.getBlockX());
|
||||||
int j = Mth.floor(player.getZ()) >> 4;
|
int j = SectionPos.blockToSectionCoord(player.getBlockZ());
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
|
||||||
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
||||||
@ -198,7 +203,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
List<ServerPlayer> list = Lists.newArrayList();
|
List<ServerPlayer> list = Lists.newArrayList();
|
||||||
List<ServerPlayer> list1 = this.level.players();
|
List<ServerPlayer> list1 = this.level.players();
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||||
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
|
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
|
||||||
List<Entity> list = Lists.newArrayList();
|
List<Entity> list = Lists.newArrayList();
|
||||||
List<Entity> list1 = Lists.newArrayList();
|
List<Entity> list1 = Lists.newArrayList();
|
||||||
@ -222,7 +227,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // keep the vanilla logic here - this is REQUIRED or else passengers and their vehicles disappear!
|
+ // keep the vanilla logic here - this is REQUIRED or else passengers and their vehicles disappear!
|
||||||
+ // (and god knows what the leash thing is)
|
+ // (and god knows what the leash thing is)
|
||||||
|
|
||||||
- if (entity != player && entity.xChunk == chunk.getPos().x && entity.zChunk == chunk.getPos().z) {
|
- if (entity != player && entity.chunkPosition().equals(chunk.getPos())) {
|
||||||
- playerchunkmap_entitytracker.updatePlayer(player);
|
- playerchunkmap_entitytracker.updatePlayer(player);
|
||||||
- if (entity instanceof Mob && ((Mob) entity).getLeashHolder() != null) {
|
- if (entity instanceof Mob && ((Mob) entity).getLeashHolder() != null) {
|
||||||
- list.add(entity);
|
- list.add(entity);
|
||||||
@ -242,16 +247,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
Iterator iterator;
|
Iterator iterator;
|
||||||
Entity entity1;
|
Entity entity1;
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||||
|
|
||||||
public class TrackedEntity {
|
|
||||||
|
|
||||||
- private final ServerEntity serverEntity;
|
|
||||||
+ final ServerEntity serverEntity; // Paper - private -> package private
|
|
||||||
private final Entity entity;
|
|
||||||
private final int range;
|
|
||||||
private SectionPos lastSectionPos;
|
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
||||||
this.lastSectionPos = SectionPos.of(entity);
|
this.lastSectionPos = SectionPos.of(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,9 +279,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // stuff could have been removed, so we need to check the trackedPlayers set
|
+ // stuff could have been removed, so we need to check the trackedPlayers set
|
||||||
+ // for players that were removed
|
+ // for players that were removed
|
||||||
+
|
+
|
||||||
+ for (ServerPlayer player : this.seenBy.toArray(new ServerPlayer[0])) { // avoid CME
|
+ for (ServerPlayerConnection conn : this.seenBy.toArray(new ServerPlayerConnection[0])) { // avoid CME
|
||||||
+ if (newTrackerCandidates == null || !newTrackerCandidates.contains(player)) {
|
+ if (newTrackerCandidates == null || !newTrackerCandidates.contains(conn)) {
|
||||||
+ this.updatePlayer(player);
|
+ this.updatePlayer(conn.getPlayer());
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@ -294,7 +290,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
|
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
||||||
int j = entity.getType().clientTrackingRange() * 16;
|
int j = entity.getType().clientTrackingRange() * 16;
|
||||||
j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper
|
j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper
|
||||||
|
|
||||||
@ -325,9 +321,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
+import net.minecraft.server.MCUtil;
|
+import net.minecraft.server.MCUtil;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ChunkMap;
|
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -348,15 +344,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
public Entity(EntityType<?> type, Level world) {
|
public Entity(EntityType<?> type, Level world) {
|
||||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||||
this.passengers = Lists.newArrayList();
|
this.passengers = ImmutableList.of();
|
||||||
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
||||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||||
@@ -0,0 +0,0 @@ public class TrackingRange
|
@@ -0,0 +0,0 @@ public class TrackingRange
|
||||||
*/
|
|
||||||
public static int getEntityTrackingRange(Entity entity, int defaultRange)
|
|
||||||
{
|
{
|
||||||
|
return defaultRange;
|
||||||
|
}
|
||||||
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return defaultRange; // Paper - enderdragon is exempt
|
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return defaultRange; // Paper - enderdragon is exempt
|
||||||
SpigotWorldConfig config = entity.level.spigotConfig;
|
SpigotWorldConfig config = entity.level.spigotConfig;
|
||||||
if ( entity instanceof ServerPlayer )
|
if ( entity instanceof ServerPlayer )
|
Loading…
Reference in New Issue
Block a user