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

Only update frozen ticks if changed (#484)

* optimize setTicksFrozen

* [ci skip] Update patch name
This commit is contained in:
hayanesuru
2025-09-09 05:39:28 +09:00
committed by GitHub
parent 89885a143a
commit 08874d1b30

View File

@@ -0,0 +1,25 @@
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 fdb7e7b00dd9223f8dc0ce174203d6835fc3962e..e3d6e802fdc72afa54e22fb1e2dc6030de33f091 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3715,7 +3715,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();