Fix enderdragon tracking range to honor vanilla

This commit is contained in:
Aikar 2020-08-25 19:38:19 -04:00
parent 6f1cc1e9d3
commit 9a12d91631

View file

@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ configuredSpigotValue = spigotWorldConfig.otherTrackingRange;
+ break;
+ case ENDERDRAGON:
+ configuredSpigotValue = 10 * 16; // default is 10 chunk range // TODO check on update
+ configuredSpigotValue = EntityTypes.ENDER_DRAGON.getChunkRange() * 16;
+ break;
+ default:
+ throw new IllegalStateException("Missing case for enum " + trackingRangeType);
@ -337,12 +337,19 @@ diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/s
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/spigotmc/TrackingRange.java
+++ b/src/main/java/org/spigotmc/TrackingRange.java
@@ -0,0 +0,0 @@ public class TrackingRange
*/
public static int getEntityTrackingRange(Entity entity, int defaultRange)
{
+ if (entity instanceof EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt
SpigotWorldConfig config = entity.world.spigotConfig;
if ( entity instanceof EntityPlayer )
{
@@ -0,0 +0,0 @@ public class TrackingRange
return config.miscTrackingRange;
} else
{
- if (entity instanceof EntityEnderDragon) return ((WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt
+ if (entity instanceof EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt
return config.otherTrackingRange;
}
}
@ -351,6 +358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // copied from above, TODO check on update
+ public static TrackingRangeType getTrackingRangeType(Entity entity)
+ {
+ if (entity instanceof EntityEnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt
+ if ( entity instanceof EntityPlayer )
+ {
+ return TrackingRangeType.PLAYER;
@ -373,7 +381,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return TrackingRangeType.MISC;
+ } else
+ {
+ if (entity instanceof EntityEnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt
+ return TrackingRangeType.OTHER;
+ }
+ }