Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Fixed #2511
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Sep 17, 2023
1 parent dcc7267 commit c9f40df
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/main/java/org/spigotmc/TrackingRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,22 @@ public class TrackingRange {
*/
public static int getEntityTrackingRange(Entity entity, int defaultRange) {
SpigotWorldConfig config = entity.world.spigotConfig;
int range = defaultRange;
if (entity instanceof EntityPlayerMP) {
range = config.playerTrackingRange;
} else if (entity.defaultActivationState || entity instanceof EntityGhast) {
range = defaultRange;
return config.playerTrackingRange;
} else if (entity.activationType == 1) {
range = config.monsterTrackingRange;
return config.monsterTrackingRange;
} else if (entity instanceof EntityGhast) {
return config.monsterTrackingRange > config.monsterActivationRange ? config.monsterTrackingRange : config.monsterActivationRange;
} else if (entity.activationType == 2) {
range = config.animalTrackingRange;
} else if (entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb) {
range = config.miscTrackingRange;
return config.animalTrackingRange;
} else {
return !(entity instanceof EntityItemFrame)
&& !(entity instanceof EntityPainting)
&& !(entity instanceof EntityItem)
&& !(entity instanceof EntityXPOrb)
? config.otherTrackingRange
: config.miscTrackingRange;
}
// Cauldron start - allow for 0 to disable tracking ranges
if (range == 0) {
return defaultRange;
}
// Cauldron end

return Math.min(config.otherTrackingRange, range);
}

}

0 comments on commit c9f40df

Please sign in to comment.