Skip to content

Commit

Permalink
Fix the sprint glitch which results in inconsistent health.
Browse files Browse the repository at this point in the history
This bug has been in the game since 1.16.4 and has been annoying several of my customers. I would rather not have to make a fork of this every time I need to provision a new server.
  • Loading branch information
pog5 authored Dec 4, 2023
1 parent 597cae6 commit f3f24de
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions patches/server/0041-Fix-sprint-glitch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: pixelNightly <[email protected]>
Date: Mon, 4 Dec 2023 16:11:36 +0200
Subject: [PATCH] Fix sprint glitch


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 23197384963b7f67e096eff18bf1809d36611923..57e6609368bf402ece1ca28b46fd1ef5813c7159 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1422,7 +1422,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
player.setRealHealth(health);
}

- player.updateScaledHealth(false);
+ this.entityData.set(LivingEntity.DATA_HEALTH_ID, player.getScaledHealth()); // Sprint glitch Fix by pafias
+ // player.updateScaledHealth(false); // Commented out to fix sprint glitch
return;
}
// CraftBukkit end

0 comments on commit f3f24de

Please sign in to comment.