Skip to content

Commit dd0810c

Browse files
Skip inactive AI ticks for unaware mobs (#13781)
1 parent 04ee8ea commit dd0810c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,17 +540,18 @@ index c4da41f3b5ba6d8492d3776654b1ce62a5015895..6a0ebbdfcc0bc07915574c1cf87463e8
540540
public void tick() {
541541
super.tick();
542542
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
543-
index c7c53ef16e104ebc48aeb8719783fb4c45d39fc2..90eaa775dc134041647618c3b965334a9bb9fd3b 100644
543+
index c7c53ef16e104ebc48aeb8719783fb4c45d39fc2..5bbb5cbb51953399c7bce547cd6968eb3c6bd130 100644
544544
--- a/net/minecraft/world/entity/Mob.java
545545
+++ b/net/minecraft/world/entity/Mob.java
546-
@@ -211,6 +211,19 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
546+
@@ -211,6 +211,20 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
547547
return this.lookControl;
548548
}
549549

550550
+ // Paper start
551551
+ @Override
552552
+ public void inactiveTick() {
553553
+ super.inactiveTick();
554+
+ if (!this.aware) return; // Paper - Do not tick AI for inactive unaware mobs
554555
+ if (this.goalSelector.inactiveTick()) {
555556
+ this.goalSelector.tick();
556557
+ }
@@ -673,7 +674,7 @@ index c482c3348267ca2b88109e34291aa860e0cde916..b11b59d80e37d272770ab51a63028fdd
673674
public void tick() {
674675
if (this.getItem().isEmpty()) {
675676
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
676-
index a80e6a23cf29cb44943339101f15565dbc19af1f..f481fd661440f77c98940cbde4a8b95818e4a22c 100644
677+
index a80e6a23cf29cb44943339101f15565dbc19af1f..26108ac0543c7b4195f149c07d8348b5b15b8bdb 100644
677678
--- a/net/minecraft/world/entity/npc/villager/Villager.java
678679
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
679680
@@ -244,11 +244,35 @@ public class Villager extends AbstractVillager implements VillagerDataHolder, Re
@@ -687,7 +688,7 @@ index a80e6a23cf29cb44943339101f15565dbc19af1f..f481fd661440f77c98940cbde4a8b958
687688
+ if (this.getUnhappyCounter() > 0) {
688689
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1);
689690
+ }
690-
+ if (this.isEffectiveAi()) {
691+
+ if (this.aware && this.isEffectiveAi()) { // Paper - Do not tick AI for inactive unaware mobs
691692
+ if (this.level().spigotConfig.tickInactiveVillagers) {
692693
+ this.customServerAiStep(this.level().getMinecraftWorld());
693694
+ } else {

0 commit comments

Comments
 (0)