Implement tracking range y setting

This commit is contained in:
Nassim Jahnke 2023-10-03 22:19:39 +10:00
parent a4d2616808
commit 7d1b302774

View File

@ -1532,9 +1532,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import net.minecraft.world.entity.Display;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.ExperienceOrb;
+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.Zombie;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.Items;
+import net.minecraft.world.level.NaturalSpawner;
@ -1805,31 +1812,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public IntOr.Default other = IntOr.Default.USE_DEFAULT;
+
+ public int get(Entity entity, int def) {
+ return def; // TODO https://github.com/PaperMC/Paper/issues/9742
+ /*
+ switch (TrackingRange.getTrackingRangeType(entity)) {
+ case PLAYER -> {
+ return player.or(def);
+ }
+ case ANIMAL -> {
+ if (entity instanceof EnderDragon) {
+ return -1; // Ender dragon is exempt
+ } else if (entity instanceof Display) {
+ return display.or(def);
+ } else if (entity instanceof Player) {
+ return player.or(def);
+ } else if (entity instanceof HangingEntity || entity instanceof ItemEntity || entity instanceof ExperienceOrb) {
+ return misc.or(def);
+ }
+ switch (entity.activationType) {
+ case ANIMAL, WATER, VILLAGER -> {
+ return animal.or(def);
+ }
+ case MONSTER -> {
+ case MONSTER, FLYING_MONSTER, RAIDER -> {
+ return monster.or(def);
+ }
+ case MISC -> {
+ return misc.or(def);
+ }
+ case ENDERDRAGON -> {
+ return -1; // Ender dragon is exempt
+ }
+ case DISPLAY -> {
+ return display.or(def);
+ default -> {
+ return other.or(def);
+ }
+ }
+
+ return other.or(def);
+ */
+ }
+ }
+ }