mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
39 lines
2.1 KiB
Diff
39 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: froobynooby <froobynooby@froobworld.com>
|
|
Date: Mon, 5 Aug 2024 20:33:57 +0800
|
|
Subject: [PATCH] Paper PR: Skip AI during inactive ticks for non-aware mobs
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/PaperMC/Paper
|
|
Paper pull request: https://github.com/PaperMC/Paper/pull/10990
|
|
|
|
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
|
index e5a93f7256d904a3401a68ca8ad5962d92ed67f3..751c8c17c3c2968fad358ae8807eaca54de82a34 100644
|
|
--- a/net/minecraft/world/entity/Mob.java
|
|
+++ b/net/minecraft/world/entity/Mob.java
|
|
@@ -210,6 +210,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
|
@Override
|
|
public void inactiveTick() {
|
|
super.inactiveTick();
|
|
+ // Paper PR start - Skip AI during inactive ticks for non-aware mobs
|
|
+ if (org.dreeam.leaf.config.modules.opt.SkipAIForNonAwareMob.enabled && !(this.isEffectiveAi() && this.aware)) {
|
|
+ return;
|
|
+ }
|
|
+ // Paper PR end - Skip AI during inactive ticks for non-aware mobs
|
|
if (this.goalSelector.inactiveTick()) {
|
|
this.goalSelector.tick();
|
|
}
|
|
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
|
index 014bb5b6e82bb11b756430999522f4b8f9356d9f..e6a750ab472eba53de1e5f9e2f507f3a0a9d94d4 100644
|
|
--- a/net/minecraft/world/entity/npc/Villager.java
|
|
+++ b/net/minecraft/world/entity/npc/Villager.java
|
|
@@ -374,7 +374,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
|
if (this.getUnhappyCounter() > 0) {
|
|
this.setUnhappyCounter(this.getUnhappyCounter() - 1);
|
|
}
|
|
- if (this.isEffectiveAi()) {
|
|
+ if (this.isEffectiveAi() && (!org.dreeam.leaf.config.modules.opt.SkipAIForNonAwareMob.enabled || this.aware)) { // Paper PR - Skip AI during inactive ticks for non-aware mobs
|
|
if (this.level().spigotConfig.tickInactiveVillagers) {
|
|
this.customServerAiStep(this.level().getMinecraftWorld());
|
|
} else {
|