9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 11:29:11 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0296-optimize-tickEffects.patch
hayanesuru f2682d84a6 optimize attribute and cleanup entity tracker (#548)
* optimize attribute

* compile fix

* redo async tracker

* rename id

* refactor

* fix comment

* reduce call

* fix entity removal

* rename

* fix

* fix ctx

* unnecessary

* rebuild patches

* fix immediately remove

closes: #555

* wrap
2025-12-10 17:00:14 -05: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 9082d41be5f390c9bd4d7afe4079e1309cd2a7c3..94fec2456206d0d5ec868ce220631c7ff4325218 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();