From bb1c0dd6fabc62d142309bdff1ce72ec112975dd Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 3 Oct 2023 22:19:39 +1000 Subject: [PATCH] Implement tracking range y setting --- patches/server/0005-Paper-config-files.patch | 44 ++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index fb08bf29e2dd..be5f0c62d0e5 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -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 new file mode 100644 -index 0000000000000000000000000000000000000000..ec5e23136423e42e4f55e6ea646b8285c1ca14e2 +index 0000000000000000000000000000000000000000..456156e5f4adbe383a611bc81cebd0446ac042f7 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -0,0 +1,534 @@ +@@ -0,0 +1,536 @@ +package io.papermc.paper.configuration; + +import com.google.common.collect.HashBasedTable; @@ -1532,9 +1532,16 @@ index 0000000000000000000000000000000000000000..ec5e23136423e42e4f55e6ea646b8285 +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..ec5e23136423e42e4f55e6ea646b8285 + 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); -+ */ + } + } + }