Add DISPLAY tracking range type (#9668)

This commit is contained in:
Warrior 2023-09-17 01:02:58 +03:00 committed by GitHub
parent ede9c06814
commit e312ebb1bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 29 deletions

View file

@ -1485,10 +1485,10 @@ index 0000000000000000000000000000000000000000..f0d4ec73bc8872a85e34f5c6b4d342e7
+}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..da7c899fbab162ee197a0593f455ebd9c5286d3c
index 0000000000000000000000000000000000000000..f45afb7e2607617d1239abeca13a9002dd9a3a18
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,530 @@
@@ -0,0 +1,531 @@
+package io.papermc.paper.configuration;
+
+import com.google.common.collect.HashBasedTable;
@ -1800,8 +1800,6 @@ index 0000000000000000000000000000000000000000..da7c899fbab162ee197a0593f455ebd9
+ 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..da7c899fbab162ee197a0593f455ebd9
+ case ENDERDRAGON -> {
+ return -1; // Ender dragon is exempt
+ }
+ case DISPLAY -> {
+ return display.or(def);
+ }
+ }
+
+ return other.or(def);