mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Add DISPLAY tracking range type (#9668)
This commit is contained in:
parent
a9be834ffa
commit
e0964c727a
2 changed files with 10 additions and 3 deletions
|
@ -1800,8 +1800,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public IntOr.Default other = IntOr.Default.USE_DEFAULT;
|
||||
+
|
||||
+ public int get(Entity entity, int def) {
|
||||
+ if (entity instanceof Display) return display.or(def);
|
||||
+
|
||||
+ switch (TrackingRange.getTrackingRangeType(entity)) {
|
||||
+ case PLAYER -> {
|
||||
+ return player.or(def);
|
||||
|
@ -1818,6 +1816,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ case ENDERDRAGON -> {
|
||||
+ return -1; // Ender dragon is exempt
|
||||
+ }
|
||||
+ case DISPLAY -> {
|
||||
+ return display.or(def);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return other.or(def);
|
||||
|
|
|
@ -107,6 +107,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ case ENDERDRAGON:
|
||||
+ configuredSpigotValue = EntityType.ENDER_DRAGON.clientTrackingRange() * 16;
|
||||
+ break;
|
||||
+ case DISPLAY:
|
||||
+ configuredSpigotValue = spigotWorldConfig.displayTrackingRange;
|
||||
+ break;
|
||||
+ default:
|
||||
+ throw new IllegalStateException("Missing case for enum " + trackingRangeType);
|
||||
+ }
|
||||
|
@ -363,6 +366,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end
|
||||
+ {
|
||||
+ return TrackingRangeType.MISC;
|
||||
+ } else if (entity instanceof Display) {
|
||||
+ return TrackingRangeType.DISPLAY;
|
||||
+ } else
|
||||
+ {
|
||||
+ return TrackingRangeType.OTHER;
|
||||
|
@ -375,7 +380,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ MONSTER,
|
||||
+ MISC,
|
||||
+ OTHER,
|
||||
+ ENDERDRAGON;
|
||||
+ ENDERDRAGON,
|
||||
+ DISPLAY;
|
||||
+ }
|
||||
+ // Paper end - optimise entity tracking
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue