Add entity tracker min Y distance config option (#9406)
This commit is contained in:
parent
1b96c64620
commit
7232506c22
2 changed files with 68 additions and 2 deletions
|
@ -1481,10 +1481,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..d47c57afafc01e25b965f1844938b2516a7bd031
|
||||
index 0000000000000000000000000000000000000000..4989f99c0d330da52aeaca5df08edfbd47b5bf3c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,484 @@
|
||||
@@ -0,0 +1,523 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.collect.HashBasedTable;
|
||||
|
@ -1520,6 +1520,8 @@ index 0000000000000000000000000000000000000000..d47c57afafc01e25b965f1844938b251
|
|||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.Difficulty;
|
||||
+import net.minecraft.world.entity.Display;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
+import net.minecraft.world.entity.MobCategory;
|
||||
+import net.minecraft.world.entity.monster.Vindicator;
|
||||
|
@ -1530,6 +1532,7 @@ index 0000000000000000000000000000000000000000..d47c57afafc01e25b965f1844938b251
|
|||
+import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
+import org.slf4j.Logger;
|
||||
+import org.spigotmc.SpigotWorldConfig;
|
||||
+import org.spigotmc.TrackingRange;
|
||||
+import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
+import org.spongepowered.configurate.objectmapping.meta.Required;
|
||||
+import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||
|
@ -1773,6 +1776,42 @@ index 0000000000000000000000000000000000000000..d47c57afafc01e25b965f1844938b251
|
|||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public TrackingRangeY trackingRangeY;
|
||||
+
|
||||
+ public class TrackingRangeY extends ConfigurationPart {
|
||||
+ public boolean enabled = false;
|
||||
+ public IntOr.Default player = IntOr.Default.USE_DEFAULT;
|
||||
+ public IntOr.Default animal = IntOr.Default.USE_DEFAULT;
|
||||
+ public IntOr.Default monster = IntOr.Default.USE_DEFAULT;
|
||||
+ public IntOr.Default misc = IntOr.Default.USE_DEFAULT;
|
||||
+ public IntOr.Default display = IntOr.Default.USE_DEFAULT;
|
||||
+ 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);
|
||||
+ }
|
||||
+ case ANIMAL -> {
|
||||
+ return animal.or(def);
|
||||
+ }
|
||||
+ case MONSTER -> {
|
||||
+ return monster.or(def);
|
||||
+ }
|
||||
+ case MISC -> {
|
||||
+ return misc.or(def);
|
||||
+ }
|
||||
+ case ENDERDRAGON -> {
|
||||
+ return -1; // Ender dragon is exempt
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return other.or(def);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public Lootables lootables;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue