9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 19:39:17 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0294-optimize-tickEffects.patch
hayanesuru 043cb215fd Optimize canHoldAnyFluid in canMaybePassThrough (#527)
* optimize canHoldAnyFluid in canMaybePassThrough

* rebuild patches

* support reload
2025-10-12 14:26:33 -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 179722eb09e3c48220ec7d7a25332a000faf710c..f2717e7c173463659dffdd223b9b2e0c9cf5c636 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -950,6 +950,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
@@ -975,6 +976,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);
@@ -983,6 +986,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
}
this.effectsToProcess.clear();
+ } // Leaf - optimize tickEffects
// CraftBukkit end
if (this.effectsDirty) {
this.updateInvisibilityStatus();