Files
Shiroha/shiroha-server/minecraft-patches/features/0059-Pufferfish-Throttle-goal-selector-during-inactive-ti.patch
T
NanaChiyo0721 1bb895c165
Shiroha CI / build (push) Canceled after 0s
Shiroha CI / Event File (push) Canceled after 0s
Fix incorrect ticket lock size computing
Yeah this would fully solve the issue of chunk unloading race condition

The same fix was already initially added at "Force clamp grid-exponent to 1~6"
2026-08-09 14:57:32 +08:00

31 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Fri, 1 May 2026 21:48:40 +0800
Subject: [PATCH] Pufferfish: Throttle goal selector during inactive ticking
A part of Pufferfish(https://github.com/Pufferfish-gg/Pufferfish)
Co-authored-by: Kevin Raneri <kevin.raneri@gmail.com>
Original patch: https://github.com/pufferfish-gg/Pufferfish/blob/ver/1.21/pufferfish-server/minecraft-patches/features/0015-Throttle-goal-selector-during-inactive-ticking.patch
Original license(GPL-3.0): https://github.com/pufferfish-gg/Pufferfish/blob/ver/1.21/PATCH-LICENSE
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index ab60915f052893a34b54d161e253fe24447a9f24..c39b77a482e894b076cca01dba72d6b3c7d119be 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -215,12 +215,14 @@ public abstract class Mob extends LivingEntity implements Targeting, EquipmentUs
return this.lookControl;
}
+ int _pufferfish_inactiveTickDisableCounter = 0; // Pufferfish - throttle inactive goal selector ticking
// Paper start
@Override
public void inactiveTick() {
super.inactiveTick();
if (!this.aware) return; // Paper - Do not tick AI for inactive unaware mobs
- if (this.goalSelector.inactiveTick()) {
+ boolean isThrottled = io.nanachiyo0721.shiroha.config.modules.optimizations.EntityGoalSelectorInactiveTickConfig.enabled && _pufferfish_inactiveTickDisableCounter++ % 20 != 0; // Pufferfish - throttle inactive goal selector ticking
+ if (this.goalSelector.inactiveTick() && !isThrottled) { // Pufferfish
this.goalSelector.tick();
}
if (this.targetSelector.inactiveTick()) {