Add DISPLAY tracking range type (#9668)

This commit is contained in:
Warrior 2023-09-17 01:02:58 +03:00
parent a9be834ffa
commit e0964c727a
2 changed files with 10 additions and 3 deletions

View file

@ -1800,8 +1800,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public IntOr.Default other = IntOr.Default.USE_DEFAULT; + public IntOr.Default other = IntOr.Default.USE_DEFAULT;
+ +
+ public int get(Entity entity, int def) { + public int get(Entity entity, int def) {
+ if (entity instanceof Display) return display.or(def);
+
+ switch (TrackingRange.getTrackingRangeType(entity)) { + switch (TrackingRange.getTrackingRangeType(entity)) {
+ case PLAYER -> { + case PLAYER -> {
+ return player.or(def); + return player.or(def);
@ -1818,6 +1816,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ case ENDERDRAGON -> { + case ENDERDRAGON -> {
+ return -1; // Ender dragon is exempt + return -1; // Ender dragon is exempt
+ } + }
+ case DISPLAY -> {
+ return display.or(def);
+ }
+ } + }
+ +
+ return other.or(def); + return other.or(def);

View file

@ -107,6 +107,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ case ENDERDRAGON: + case ENDERDRAGON:
+ configuredSpigotValue = EntityType.ENDER_DRAGON.clientTrackingRange() * 16; + configuredSpigotValue = EntityType.ENDER_DRAGON.clientTrackingRange() * 16;
+ break; + break;
+ case DISPLAY:
+ configuredSpigotValue = spigotWorldConfig.displayTrackingRange;
+ break;
+ default: + default:
+ throw new IllegalStateException("Missing case for enum " + trackingRangeType); + throw new IllegalStateException("Missing case for enum " + trackingRangeType);
+ } + }
@ -363,6 +366,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ { + {
+ return TrackingRangeType.MISC; + return TrackingRangeType.MISC;
+ } else if (entity instanceof Display) {
+ return TrackingRangeType.DISPLAY;
+ } else + } else
+ { + {
+ return TrackingRangeType.OTHER; + return TrackingRangeType.OTHER;
@ -375,7 +380,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ MONSTER, + MONSTER,
+ MISC, + MISC,
+ OTHER, + OTHER,
+ ENDERDRAGON; + ENDERDRAGON,
+ DISPLAY;
+ } + }
+ // Paper end - optimise entity tracking + // Paper end - optimise entity tracking
} }