org.spigotmc.TrackingRange Maven / Gradle / Ivy
package org.spigotmc;
import net.minecraft.server.*;
public class TrackingRange {
/**
* Gets the range an entity should be 'tracked' by players and visible in
* the client.
*
* @param defaultRange Default range defined by Mojang
*/
public static int getEntityTrackingRange(Entity entity, int defaultRange) {
SpigotWorldConfig config = entity.world.spigotConfig;
if (entity instanceof EntityPlayer) {
return config.playerTrackingRange;
} else if (entity.activationType == 1) {
return config.monsterTrackingRange;
} else if (entity instanceof EntityGhast) {
return Math.max(config.monsterTrackingRange, config.monsterActivationRange);
} else if (entity.activationType == 2) {
return config.animalTrackingRange;
} else if (entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityExperienceOrb) {
return config.miscTrackingRange;
} else {
return config.otherTrackingRange;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy