PaperMC/patches/server/0759-Add-player-health-update-API.patch
Nassim Jahnke d5f1ffc2e6
Remove somewhat broken patch
With the new chunk system it doesn't hurt too much to (temporarily) remove this until implemented in a safer manner
2022-12-19 11:46:55 +01:00

39 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: SamB440 <sam@islandearth.net>
Date: Wed, 17 Nov 2021 12:31:42 +0000
Subject: [PATCH] Add player health update API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3dbd458caf6098c57ca654fd17783e231abcfd43..9b3d37e408522cad6eb3cca280b7078a73794f1f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2228,9 +2228,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().maxHealthCache = getMaxHealth();
}
- public void sendHealthUpdate() {
+ // Paper start
+ @Override
+ public void sendHealthUpdate(final double health, final int foodLevel, final float saturationLevel) {
// Paper start - cancellable death event
- ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
+ ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket((float) health, foodLevel, saturationLevel);
if (this.getHandle().queueHealthUpdatePacket) {
this.getHandle().queuedHealthUpdatePacket = packet;
} else {
@@ -2238,7 +2240,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end
}
-
+
+ @Override
+ public void sendHealthUpdate() {
+ this.sendHealthUpdate(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel());
+ }
+ // Paper end
+
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
if (!this.scaledHealth && !force) {
return;