From e0964c727a6421802c6fdcfc9e43abeedacf3216 Mon Sep 17 00:00:00 2001 From: Warrior <50800980+Warriorrrr@users.noreply.github.com> Date: Sun, 17 Sep 2023 01:02:58 +0300 Subject: [PATCH] Add DISPLAY tracking range type (#9668) --- patches/server/Paper-config-files.patch | 5 +++-- .../Use-distance-map-to-optimise-entity-tracker.patch | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index 3b7126b2c0..592a0e49a3 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -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); diff --git a/patches/server/Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch index 76b9ae43a7..1aa1b10ca7 100644 --- a/patches/server/Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch @@ -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 }