9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0294-optimize-tickEffects.patch
Creeam 3994984604 Improved fix of MC-298464 (#524)
* Improved fix of MC-298464

* Remove configurable & cleanup

* [ci skip] Fix patch order
2025-10-13 00:29:05 -04:00

36 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Sat, 30 Aug 2025 20:30:37 +0900
Subject: [PATCH] optimize tickEffects
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index efbad651cd6fa1ea73265761f8e91f84c07316d5..dc5cbabe8909cedf79e915a6129bfe414d69d106 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -951,6 +951,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
protected void tickEffects() {
if (this.level() instanceof ServerLevel serverLevel) {
+ if (!this.activeEffects.isEmpty()) { // Leaf - optimize tickEffects
Iterator<Holder<MobEffect>> iterator = this.activeEffects.keySet().iterator();
this.isTickingEffects = true; // CraftBukkit
@@ -976,6 +977,8 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
// CraftBukkit start
this.isTickingEffects = false;
+ } // Leaf - optimize tickEffects
+ if (!effectsToProcess.isEmpty()) { // Leaf - optimize tickEffects
for (ProcessableEffect effect : this.effectsToProcess) {
if (effect.effect != null) {
this.addEffect(effect.effect, effect.cause);
@@ -984,6 +987,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
}
this.effectsToProcess.clear();
+ } // Leaf - optimize tickEffects
// CraftBukkit end
if (this.effectsDirty) {
this.updateInvisibilityStatus();