Implement tracking range y setting

This commit is contained in:
Nassim Jahnke 2023-10-03 22:19:39 +10:00
parent f6969b6374
commit bb1c0dd6fa
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

@ -1490,10 +1490,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 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 new file mode 100644
index 0000000000000000000000000000000000000000..ec5e23136423e42e4f55e6ea646b8285c1ca14e2 index 0000000000000000000000000000000000000000..456156e5f4adbe383a611bc81cebd0446ac042f7
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,534 @@ @@ -0,0 +1,536 @@
+package io.papermc.paper.configuration; +package io.papermc.paper.configuration;
+ +
+import com.google.common.collect.HashBasedTable; +import com.google.common.collect.HashBasedTable;
@ -1532,9 +1532,16 @@ index 0000000000000000000000000000000000000000..ec5e23136423e42e4f55e6ea646b8285
+import net.minecraft.world.entity.Display; +import net.minecraft.world.entity.Display;
+import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.ExperienceOrb;
+import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.entity.MobCategory;
+import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
+import net.minecraft.world.entity.decoration.HangingEntity;
+import net.minecraft.world.entity.decoration.ItemFrame;
+import net.minecraft.world.entity.decoration.Painting;
+import net.minecraft.world.entity.item.ItemEntity;
+import net.minecraft.world.entity.monster.Vindicator; +import net.minecraft.world.entity.monster.Vindicator;
+import net.minecraft.world.entity.monster.Zombie; +import net.minecraft.world.entity.monster.Zombie;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.Item; +import net.minecraft.world.item.Item;
+import net.minecraft.world.item.Items; +import net.minecraft.world.item.Items;
+import net.minecraft.world.level.NaturalSpawner; +import net.minecraft.world.level.NaturalSpawner;
@ -1805,31 +1812,26 @@ index 0000000000000000000000000000000000000000..ec5e23136423e42e4f55e6ea646b8285
+ 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) {
+ return def; // TODO https://github.com/PaperMC/Paper/issues/9742 + if (entity instanceof EnderDragon) {
+ /* + return -1; // Ender dragon is exempt
+ switch (TrackingRange.getTrackingRangeType(entity)) { + } else if (entity instanceof Display) {
+ case PLAYER -> { + return display.or(def);
+ } else if (entity instanceof Player) {
+ return player.or(def); + return player.or(def);
+ } + } else if (entity instanceof HangingEntity || entity instanceof ItemEntity || entity instanceof ExperienceOrb) {
+ case ANIMAL -> {
+ return animal.or(def);
+ }
+ case MONSTER -> {
+ return monster.or(def);
+ }
+ case MISC -> {
+ return misc.or(def); + return misc.or(def);
+ } + }
+ case ENDERDRAGON -> { + switch (entity.activationType) {
+ return -1; // Ender dragon is exempt + case ANIMAL, WATER, VILLAGER -> {
+ return animal.or(def);
+ } + }
+ case DISPLAY -> { + case MONSTER, FLYING_MONSTER, RAIDER -> {
+ return display.or(def); + return monster.or(def);
+ } + }
+ } + default -> {
+
+ return other.or(def); + return other.or(def);
+ */ + }
+ }
+ } + }
+ } + }
+ } + }