mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@7525225b fireballs weren't respecting the mob griefing override config, closes #1702, supercedes #1708 PurpurMC/Purpur@a260e4f8 hostile mobs would still spawn on blue/packed ice in certain scenarios - fixes #1701 (#1709) PurpurMC/Purpur@b66c0af9 Shift + right click with mending option gives mass xp when it shouldn't - closes #1694 (#1710)
446 lines
24 KiB
Diff
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 646ca37bba6da8ab0babbf4a1e6ba88e75658e72..1d9b32476c1b89984f1afa8e906ca09472b8d6b2 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -830,6 +830,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 c36d133e877353f9509543b0833be745286574e9..ee8cdf62642b2713dbae9d1735db7c5e5fd55a55 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 881575864f864305973033ac6e664fc47e49ca16..7d5940327c5e7a945165228d502f678a8234cd02 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 c551b8c8c9b9d070afdbcf5cfcdb35e99830fd91..b61b9c512f23d5ae0465fe7196fbb222918b0988 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 ae68a19a0b13bc626efec6a028f3abba4a436f3b..c5526952961c3c2705f946021ff3a8306ad2bde1 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> type, Level level) {
|
|
super(type, 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 a952e78ac0c1fa7a2728fc3036b93e69e2fefb8d..8540ee65e1733ab37f77c964b8514e08d08781f3 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> type, Level level) {
|
|
super(type, 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 7643e8d1b89a23354c27395509407c20e3d93b69..ccd4a12b5bf2a064f8ea7d49113a18b541778ca5 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> type, Level level) {
|
|
super(type, 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 37b1674c3f89d7ddba054b066df957f3337f4a89..e437dad4f65a77b1ecbefe324355e33e0abcb76d 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> type, Level level) {
|
|
super(type, 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 58ee22461c0330e2fbbbf283c154b8141e2d1953..1ef0fa87f55a4fe6309ed456b0458287925f9835 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> type, Level level) {
|
|
super(type, 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 c309b01a461ddb47d20a6c96bd693e4850bd731b..5ccf6e916c5c5ebe034a55b71725f740a21f4f83 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> type, Level level) {
|
|
super(type, 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 b21ca373220f80c81cadab1eda482057d6366caf..8d0b364149c3772b95e97136f77749f7aadd442a 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> type, Level level) {
|
|
super(type, level);
|
|
@@ -350,10 +351,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 e9881eac70feebeb08f464efd4fa953cec9f62bf..6edd808e8d0c940dfa6dea463d549d6e80a5d465 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> type, Level level) {
|
|
super(type, 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 e89ff53c568013a5f53afcf5759314221d37adf4..5443677ed4ecaaf3b647e3f72802e80d7d22fad9 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> type, Level level) {
|
|
this(type, 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();
|