mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
--------- Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> Co-authored-by: Fortern <blueten.ki@gmail.com> Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com> Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com> Co-authored-by: MC_XiaoHei <xiaohei.xor7@outlook.com>
27 lines
1.4 KiB
Diff
27 lines
1.4 KiB
Diff
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 73ba442b9d39bc021cd5eb6c1c0f98aed94a5a02..c83ad2553145b66aad000be3b82fec57f56359ce 100644
|
|
--- a/net/minecraft/world/entity/Mob.java
|
|
+++ b/net/minecraft/world/entity/Mob.java
|
|
@@ -203,11 +203,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()) {
|