9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch
2025-10-11 01:35:35 +03:00

446 lines
24 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sun, 23 Mar 2025 01:16:35 +0300
Subject: [PATCH] Dynamic Activation of Brain
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
index ca21597263cb430e2a5ae07e8cecfb0d53a270d2..226088405c019922085285ba5d04d7c131470c69 100644
--- a/io/papermc/paper/entity/activation/ActivationRange.java
+++ b/io/papermc/paper/entity/activation/ActivationRange.java
@@ -167,6 +167,21 @@ public final class ActivationRange {
}
ActivationRange.activateEntity(entity);
+
+ // DivineMC start - Dynamic Activation of Brain
+ if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabEnabled && entity.getType().dabEnabled && (!org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabDontEnableIfInWater || entity.getType().is(net.minecraft.tags.EntityTypeTags.CAN_BREATHE_UNDER_WATER) || !entity.isInWaterOrRain())) {
+ if (!entity.activatedPriorityReset) {
+ entity.activatedPriorityReset = true;
+ entity.activatedPriority = org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabMaximumActivationFrequency;
+ }
+ int squaredDistance = (int) player.distanceToSqr(entity);
+ entity.activatedPriority = squaredDistance > org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabStartDistanceSquared ?
+ Math.max(1, Math.min(squaredDistance >> org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabActivationDistanceMod, entity.activatedPriority)) :
+ 1;
+ } else {
+ entity.activatedPriority = 1;
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
}
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 2f09f9c02e63563828dd7000352baf2723a0ac59..e1497f28b870e014e89ec6b189ee7989b07bb933 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -829,6 +829,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.entityTickList
.forEach(
entity -> {
+ entity.activatedPriorityReset = false; // DivineMC - Dynamic Activation of Brain
if (!entity.isRemoved()) {
if (!tickRateManager.isEntityFrozen(entity)) {
entity.checkDespawn();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index b5004de3ca8951a5884a3b62b129aa2588a67af7..6724ef32e4d0de6ca0965b8b96430b68179b4bd7 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -367,6 +367,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
public boolean fixedPose = false; // Paper - Expand Pose API
private final int despawnTime; // Paper - entity despawn time limit
public int totalEntityAge; // Paper - age-like counter for all entities
+ public boolean activatedPriorityReset = false; // DivineMC - Dynamic Activation of Brain
+ public int activatedPriority = org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabMaximumActivationFrequency; // DivineMC - Dynamic Activation of Brain
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
// Paper start - EAR 2
public final boolean defaultActivationState;
diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java
index c7544cad07293a504204cfa8bf9d8322ef16118c..e680780a0e46e9e5f9126bd11a20b918e8c36066 100644
--- a/net/minecraft/world/entity/EntityType.java
+++ b/net/minecraft/world/entity/EntityType.java
@@ -1192,6 +1192,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
private final boolean canSpawnFarFromPlayer;
private final int clientTrackingRange;
private final int updateInterval;
+ public boolean dabEnabled = false; // DivineMC - Dynamic Activation of Brain
private final String descriptionId;
@Nullable
private Component description;
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index c3a7a41b399590e2c004fda4e97b1935575c4972..dd25b049615c4465c1bf9ea0004dd649f5c55c5f 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -220,10 +220,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override
public void inactiveTick() {
super.inactiveTick();
- if (this.goalSelector.inactiveTick()) {
+ if (this.goalSelector.inactiveTick(this.activatedPriority, true)) { // DivineMC - Dynamic Activation of Brain
this.goalSelector.tick();
}
- if (this.targetSelector.inactiveTick()) {
+ if (this.targetSelector.inactiveTick(this.activatedPriority, true)) { // DivineMC - Dynamic Activation of Brain
this.targetSelector.tick();
}
}
@@ -784,13 +784,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
// Paper end - Allow nerfed mobs to jump and float
this.sensing.tick();
int i = this.tickCount + this.getId();
+ // DivineMC start - Dynamic Activation of Brain
if (i % 2 != 0 && this.tickCount > 1) {
- this.targetSelector.tickRunningGoals(false);
- this.goalSelector.tickRunningGoals(false);
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false))
+ this.targetSelector.tickRunningGoals(false);
+ if (this.goalSelector.inactiveTick(this.activatedPriority, false))
+ this.goalSelector.tickRunningGoals(false);
} else {
- this.targetSelector.tick();
- this.goalSelector.tick();
+ if (this.targetSelector.inactiveTick(this.activatedPriority, false))
+ this.targetSelector.tick();
+ if (this.goalSelector.inactiveTick(this.activatedPriority, false))
+ this.goalSelector.tick();
}
+ // DivineMC end - Dynamic Activation of Brain
this.navigation.tick();
this.customServerAiStep((ServerLevel)this.level());
diff --git a/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java b/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java
index f6c673b1abe53afcb14fd68d590431027ed29f67..1e5312e02298c63c168526a960d688dc03581cee 100644
--- a/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java
+++ b/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java
@@ -36,7 +36,11 @@ public class VillagerPanicTrigger extends Behavior<Villager> {
@Override
protected void tick(ServerLevel level, Villager owner, long gameTime) {
- if (gameTime % 100L == 0L) {
+ // DivineMC start - Dynamic Activation of Brain
+ if (owner.nextGolemPanic < 0) owner.nextGolemPanic = gameTime + 100;
+ if (--owner.nextGolemPanic < gameTime) {
+ owner.nextGolemPanic = -1;
+ // DivineMC end - Dynamic Activation of Brain
owner.spawnGolemIfNeeded(level, gameTime, 3);
}
}
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 653c58c7637c46c8b46a5082f671324a2221d431..a4328a427636aa845d6627ecb75a9efe7320bb15 100644
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -34,10 +34,14 @@ public class GoalSelector {
}
// Paper start - EAR 2
- public boolean inactiveTick() {
+ // DivineMC start - Dynamic Activation of Brain
+ public boolean inactiveTick(int tickRate, boolean inactive) {
+ if (inactive && !org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.dabEnabled) tickRate = 4;
+ tickRate = Math.min(tickRate, 3);
this.curRate++;
- return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct
+ return this.curRate % tickRate == 0;
}
+ // DivineMC end - Dynamic Activation of Brain
public boolean hasTasks() {
for (WrappedGoal task : this.availableGoals) {
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index 3a2451bfa5e59de51d703eac8a536284e1d3348b..2422895ca4a2939f52f119384f498bd23bf9b7cc 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -112,6 +112,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
private float spinningAnimationTicks0;
public boolean forceDancing = false; // CraftBukkit
private org.purpurmc.purpur.controller.FlyingMoveControllerWASD purpurController; // Purpur - Ridables
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Allay(EntityType<? extends Allay> entityType, Level level) {
super(entityType, level);
@@ -266,10 +267,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- AllayAi.updateActivity(this);
- super.customServerAiStep(level);
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ AllayAi.updateActivity(this);
+ super.customServerAiStep(level);
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
@Override
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index 1927f8be451258d9f0f8eec1617d103a4140e1e7..781ce63ff615d718cdf14bf6c3a4c742f628a920 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -111,6 +111,7 @@ public class Axolotl extends Animal implements Bucketable {
public final BinaryAnimator onGroundAnimator = new BinaryAnimator(10, Mth::easeInOutSine);
public final BinaryAnimator movingAnimator = new BinaryAnimator(10, Mth::easeInOutSine);
private static final int REGEN_BUFF_BASE_DURATION = 100;
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Axolotl(EntityType<? extends Axolotl> entityType, Level level) {
super(entityType, level);
@@ -372,13 +373,16 @@ public class Axolotl extends Animal implements Bucketable {
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- AxolotlAi.updateActivity(this);
- if (!this.isNoAi()) {
- Optional<Integer> memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS);
- this.setPlayingDead(memory.isPresent() && memory.get() > 0);
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ AxolotlAi.updateActivity(this);
+ if (!this.isNoAi()) {
+ Optional<Integer> memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS);
+ this.setPlayingDead(memory.isPresent() && memory.get() > 0);
+ }
}
+ // DivineMC end - Dynamic Activation of Brain
}
public static AttributeSupplier.Builder createAttributes() {
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
index 1a504e30602d7d8feaf7a9180adf6382596aae02..9656c1bf22b1b6c945a8ba5603742261db650fd5 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -105,6 +105,7 @@ public class Frog extends Animal {
public final AnimationState swimIdleAnimationState = new AnimationState();
private org.purpurmc.purpur.controller.MoveControllerWASD purpurLandController; // Purpur - Ridables
private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurWaterController; // Purpur - Ridables
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Frog(EntityType<? extends Animal> entityType, Level level) {
super(entityType, level);
@@ -258,10 +259,13 @@ public class Frog extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- FrogAi.updateActivity(this);
- super.customServerAiStep(level);
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ FrogAi.updateActivity(this);
+ super.customServerAiStep(level);
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
@Override
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
index 8312a0d5229043fd84125db809c4346bb80f2bc0..1a437d3e09484f4bacc4ef22b3e5f1c3c58ca42f 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -64,6 +64,7 @@ public class Tadpole extends AbstractFish {
);
public boolean ageLocked; // Paper
private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurController; // Purpur - Ridables
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Tadpole(EntityType<? extends AbstractFish> entityType, Level level) {
super(entityType, level);
@@ -134,10 +135,13 @@ public class Tadpole extends AbstractFish {
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- TadpoleAi.updateActivity(this);
- super.customServerAiStep(level);
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ TadpoleAi.updateActivity(this);
+ super.customServerAiStep(level);
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
public static AttributeSupplier.Builder createAttributes() {
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
index 73fe7a8c216aed7dc2274fd53fb126d85ec5137d..d4de51a8fd1f2adfc35eb6e23cda6905bd376515 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -93,6 +93,7 @@ public class Goat extends Animal {
private static final boolean DEFAULT_HAS_RIGHT_HORN = true;
private boolean isLoweringHead;
private int lowerHeadTick;
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Goat(EntityType<? extends Goat> entityType, Level level) {
super(entityType, level);
@@ -232,10 +233,13 @@ public class Goat extends Animal {
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- GoatAi.updateActivity(this);
- super.customServerAiStep(level);
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ GoatAi.updateActivity(this);
+ super.customServerAiStep(level);
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
@Override
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index b22519a6d39bd52381fa6c17b9a415944374368b..10e36ec8d5e3ee44400e916632771a9cc1381664 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -87,6 +87,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
MemoryModuleType.PACIFIED,
MemoryModuleType.IS_PANICKING
);
+ private int behaviorTick; // DivineMC - Dynamic Activation of Brain
public Hoglin(EntityType<? extends Hoglin> entityType, Level level) {
super(entityType, level);
@@ -205,18 +206,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- HoglinAi.updateActivity(this);
- if (this.isConverting()) {
- this.timeInOverworld++;
- if (this.timeInOverworld > 300) {
- this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED);
- this.finishConversion();
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ HoglinAi.updateActivity(this);
+ if (this.isConverting()) {
+ this.timeInOverworld++;
+ if (this.timeInOverworld > 300) {
+ this.makeSound(SoundEvents.HOGLIN_CONVERTED_TO_ZOMBIFIED);
+ this.finishConversion();
+ }
+ } else {
+ this.timeInOverworld = 0;
}
- } else {
- this.timeInOverworld = 0;
}
+ // DivineMC end - Dynamic Activation of Brain
}
@Override
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index dea7c211a2d2ee8f1833eaad49513b3690b06c55..e2b467cfc19dfcf1fb617e57251451aa88de727d 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -128,6 +128,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
private static final com.mojang.serialization.Codec<java.util.Set<net.minecraft.world.item.Item>> ITEM_SET_CODEC = net.minecraft.core.registries.BuiltInRegistries.ITEM
.byNameCodec().listOf().xmap(java.util.HashSet::new, List::copyOf);
// CraftBukkit end
+ private int behaviorTick; // DivineMC - Dynamic Activation of Brain
public Piglin(EntityType<? extends AbstractPiglin> entityType, Level level) {
super(entityType, level);
@@ -345,10 +346,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- PiglinAi.updateActivity(this);
- super.customServerAiStep(level);
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ PiglinAi.updateActivity(this);
+ super.customServerAiStep(level);
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
@Override
diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java
index ac7691a2a3e4c9db040408d1ecba780a89dea50e..e3478244e430faa614f23c288019303bd6bb0e04 100644
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -107,6 +107,7 @@ public class Warden extends Monster implements VibrationSystem {
private final VibrationSystem.User vibrationUser;
private VibrationSystem.Data vibrationData;
AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList());
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Warden(EntityType<? extends Monster> entityType, Level level) {
super(entityType, level);
@@ -300,19 +301,22 @@ public class Warden extends Monster implements VibrationSystem {
@Override
protected void customServerAiStep(ServerLevel level) {
- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider
- this.getBrain().tick(level, this);
- super.customServerAiStep(level);
- if ((this.tickCount + this.getId()) % 120 == 0) {
- applyDarknessAround(level, this.position(), this, 20);
- }
+ // DivineMC start - Dynamic Activation of Brain
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) { // Purpur - only use brain if no rider
+ this.getBrain().tick(level, this);
+ super.customServerAiStep(level);
+ if ((this.tickCount + this.getId()) % 120 == 0) {
+ applyDarknessAround(level, this.position(), this, 20);
+ }
- if (this.tickCount % 20 == 0) {
- this.angerManagement.tick(level, this::canTargetEntity);
- this.syncClientAngerLevel();
- }
+ if (this.tickCount % 20 == 0) {
+ this.angerManagement.tick(level, this::canTargetEntity);
+ this.syncClientAngerLevel();
+ }
- WardenAi.updateActivity(this);
+ WardenAi.updateActivity(this);
+ }
+ // DivineMC end - Dynamic Activation of Brain
}
@Override
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
index 3bcd3b7c9f7ad408d66fad5b1b70ebee96a61b43..94424c01b0c4a28c7eafd5c02d068b9c41e451e2 100644
--- a/net/minecraft/world/entity/npc/Villager.java
+++ b/net/minecraft/world/entity/npc/Villager.java
@@ -178,6 +178,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
);
private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers
private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers
+ public long nextGolemPanic = -1; // DivineMC - Dynamic Activation of Brain
+ private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain
public Villager(EntityType<? extends Villager> entityType, Level level) {
this(entityType, level, VillagerType.PLAINS);
@@ -398,7 +400,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
} else {
this.isLobotomized = false;
}
- if (!inactive && (getRider() == null || !this.isControllable())) { // Purpur - Ridables
+ if (!inactive && this.behaviorTick++ % this.activatedPriority == 0 && (getRider() == null || !this.isControllable())) { // Purpur - Ridables // DivineMC - Dynamic Activation of Brain
this.getBrain().tick(level, this); // Paper - EAR 2
}
else if (this.isLobotomized && shouldRestock()) restock();