diff --git a/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch index 0ccd1e3dc9..71c4fe39ec 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch @@ -386,3 +386,11 @@ if (flag) { if (this.seenBy.add(player.connection)) { this.serverEntity.addPairing(player); +@@ -1506,6 +1592,7 @@ + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + int j = entity.getType().clientTrackingRange() * 16; ++ j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper + + if (j > i) { + i = j; diff --git a/paper-server/src/main/java/org/spigotmc/TrackingRange.java b/paper-server/src/main/java/org/spigotmc/TrackingRange.java index 73f9563551..bb06f89a29 100644 --- a/paper-server/src/main/java/org/spigotmc/TrackingRange.java +++ b/paper-server/src/main/java/org/spigotmc/TrackingRange.java @@ -7,7 +7,6 @@ import net.minecraft.world.entity.ExperienceOrb; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.entity.decoration.Painting; import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.monster.Ghast; public class TrackingRange { @@ -30,22 +29,21 @@ public class TrackingRange if ( entity instanceof ServerPlayer ) { return config.playerTrackingRange; - } else if ( entity.activationType == ActivationRange.ActivationType.MONSTER || entity.activationType == ActivationRange.ActivationType.RAIDER ) - { - return config.monsterTrackingRange; - } else if ( entity instanceof Ghast ) - { - if ( config.monsterTrackingRange > config.monsterActivationRange ) - { + // Paper start - Simplify and set water mobs to animal tracking range + } + switch (entity.activationType) { + case RAIDER: + case MONSTER: + case FLYING_MONSTER: return config.monsterTrackingRange; - } else - { - return config.monsterActivationRange; - } - } else if ( entity.activationType == ActivationRange.ActivationType.ANIMAL ) - { - return config.animalTrackingRange; - } else if ( entity instanceof ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb ) + case WATER: + case VILLAGER: + case ANIMAL: + return config.animalTrackingRange; + case MISC: + } + if ( entity instanceof ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb ) + // Paper end { return config.miscTrackingRange; } else if ( entity instanceof Display ) @@ -53,6 +51,7 @@ public class TrackingRange return config.displayTrackingRange; } else { + if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return ((net.minecraft.server.level.ServerLevel)(entity.getCommandSenderWorld())).getChunkSource().chunkMap.serverViewDistance; // Paper - enderdragon is exempt return config.otherTrackingRange; } }