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/0299-Only-update-frozen-ticks-if-changed.patch
hayanesuru fe444c434f Update optimize entity despawn (#454)
* update partial sort in despawn map

* inline get pos

* cache difficulty

* refactor

* fix fallback extract

* remove test code

* cleanup

* direct compare

* cleanup

* cleanup

* fix axis and remove bucket

* reduce alloc

* paper vertical fallback

* add 2 dimension

* cleanup
2025-09-14 20:45:57 -04:00

26 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Sat, 30 Aug 2025 20:31:35 +0900
Subject: [PATCH] Only update frozen ticks if changed
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 1799cdc0b6c1e585e7e1eeab3828ea0252ae2097..20727a5abc7fad5a70eb2b98aa3699b054782a3b 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3707,7 +3707,13 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
if (this.level() instanceof ServerLevel serverLevel) {
if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API
- this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2));
+ // Leaf start - Only update frozen ticks if changed
+ int ticksForzen = this.getTicksFrozen();
+ int newTicksForzen = Math.max(0, ticksForzen - 2);
+ if (ticksForzen != newTicksForzen) {
+ this.setTicksFrozen(newTicksForzen);
+ }
+ // Leaf end - Only update frozen ticks if changed
}
this.removeFrost();