Fix activation range config and water animal status (#12047)

This commit is contained in:
Lulu13022002
2025-01-31 13:13:14 +01:00
committed by GitHub
parent d4a957849c
commit 5bcfb12a99
2 changed files with 7 additions and 6 deletions

View File

@ -15,7 +15,7 @@ Adds villagers as separate config
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..bd888ef719b9bfc93bace0b1d0fb771ac659f515 index 0000000000000000000000000000000000000000..ade6110cc6adb1263c0359ff7e96e96b959e61f3
--- /dev/null --- /dev/null
+++ b/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java
@@ -0,0 +1,318 @@ @@ -0,0 +1,318 @@
@ -105,10 +105,10 @@ index 0000000000000000000000000000000000000000..bd888ef719b9bfc93bace0b1d0fb771a
+ * @return boolean If it should always tick. + * @return boolean If it should always tick.
+ */ + */
+ public static boolean initializeEntityActivationState(final Entity entity, final SpigotWorldConfig config) { + public static boolean initializeEntityActivationState(final Entity entity, final SpigotWorldConfig config) {
+ return (entity.activationType == ActivationType.MISC && config.miscActivationRange == 0) + return (entity.activationType == ActivationType.MISC && config.miscActivationRange <= 0)
+ || (entity.activationType == ActivationType.RAIDER && config.raiderActivationRange == 0) + || (entity.activationType == ActivationType.RAIDER && config.raiderActivationRange <= 0)
+ || (entity.activationType == ActivationType.ANIMAL && config.animalActivationRange == 0) + || (entity.activationType == ActivationType.ANIMAL && config.animalActivationRange <= 0)
+ || (entity.activationType == ActivationType.MONSTER && config.monsterActivationRange == 0) + || (entity.activationType == ActivationType.MONSTER && config.monsterActivationRange <= 0)
+ || (entity.activationType == ActivationType.VILLAGER && config.villagerActivationRange <= 0) + || (entity.activationType == ActivationType.VILLAGER && config.villagerActivationRange <= 0)
+ || (entity.activationType == ActivationType.WATER && config.waterActivationRange <= 0) + || (entity.activationType == ActivationType.WATER && config.waterActivationRange <= 0)
+ || (entity.activationType == ActivationType.FLYING_MONSTER && config.flyingMonsterActivationRange <= 0) + || (entity.activationType == ActivationType.FLYING_MONSTER && config.flyingMonsterActivationRange <= 0)

View File

@ -4,6 +4,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.FlyingMob; import net.minecraft.world.entity.FlyingMob;
import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ambient.AmbientCreature; import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.AgeableWaterCreature;
import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.animal.WaterAnimal;
import net.minecraft.world.entity.monster.Enemy; import net.minecraft.world.entity.monster.Enemy;
import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.Villager;
@ -28,7 +29,7 @@ public enum ActivationType {
* @return activation type * @return activation type
*/ */
public static ActivationType activationTypeFor(final Entity entity) { public static ActivationType activationTypeFor(final Entity entity) {
if (entity instanceof WaterAnimal) { if (entity instanceof WaterAnimal || entity instanceof AgeableWaterCreature) {
return ActivationType.WATER; return ActivationType.WATER;
} else if (entity instanceof Villager) { } else if (entity instanceof Villager) {
return ActivationType.VILLAGER; return ActivationType.VILLAGER;