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/0304-Only-update-frozen-ticks-if-changed.patch
hayanesuru 08874d1b30 Only update frozen ticks if changed (#484)
* optimize setTicksFrozen

* [ci skip] Update patch name
2025-09-08 16:39:28 -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 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();