From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 15 Aug 2022 10:45:13 +0800 Subject: [PATCH] Throttle goal selector during inactive ticking This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java index 4994dcb209dd82d60559cfc453198b75cbfa1511..37ad911648aa88bdb5132a819806a5a303438dbf 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java @@ -217,11 +217,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return this.lookControl; } + int inactiveTickDisableCounter = 0; // Leaves - throttle inactive goal selector ticking // Paper start @Override public void inactiveTick() { super.inactiveTick(); - if (this.goalSelector.inactiveTick()) { + boolean isThrottled = org.leavesmc.leaves.LeavesConfig.performance.throttleInactiveGoalSelectorTick && (inactiveTickDisableCounter++ % 20 != 0); // Leaves - throttle inactive goal selector ticking + if (this.goalSelector.inactiveTick() && !isThrottled) { // Leaves - throttle inactive goal selector ticking this.goalSelector.tick(); } if (this.targetSelector.inactiveTick()) {