9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

optimize entity tick effects (#481)

* optimize tickEffects

* move down

* [ci skip] Fix typo
This commit is contained in:
hayanesuru
2025-09-01 12:31:19 +09:00
committed by GitHub
parent 2f835efe4a
commit 25c60030d5

View File

@@ -0,0 +1,35 @@
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 8baa17d2eadfa83b1fcb36fcd1408e917b883989..0d28c1b11dacd6487185d9f8a5a042afa3a9863b 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();