9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 19:39:17 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0116-Fix-sprint-glitch.patch
Dreeam 9a4efaa230 Drop patch that causes performance regression
Originally vanilla logic is to use stream, and Mojang switched it to Guava's Collections2
since 1.21.4. It is much faster than using stream or manually adding to a new ArrayList.
Manually adding to a new ArrayList requires allocating a new object array. However, the Collections2
lazy handles filter condition on iteration, so much better.
2025-08-04 19:25:56 +08:00

21 lines
976 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: pixelNightly <pixelnightly@proton.me>
Date: Mon, 4 Dec 2023 16:11:36 +0200
Subject: [PATCH] Fix sprint glitch
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index f712d4445d8ffdc8dbd5f51c2a8104b097df11d1..199d97ceb0cbb87a9ed88d2f34da144539d11d4c 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1419,7 +1419,8 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
player.setRealHealth(health);
}
- player.updateScaledHealth(false);
+ //player.updateScaledHealth(false); // Leaf - Fix sprint glitch - commented out
+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // Leaf - Fix sprint glitch
return;
}
// CraftBukkit end