aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0822-Add-player-health-update-API.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0822-Add-player-health-update-API.patch')
-rw-r--r--patches/server/0822-Add-player-health-update-API.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/0822-Add-player-health-update-API.patch b/patches/server/0822-Add-player-health-update-API.patch
new file mode 100644
index 0000000000..12eb8fbfb7
--- /dev/null
+++ b/patches/server/0822-Add-player-health-update-API.patch
@@ -0,0 +1,39 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: SamB440 <[email protected]>
+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 097f8d360fcdd96f95ece64d4d1368e36408d451..c6cd4a5790384811f3171ce740afb9459f3d6fc0 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+@@ -1981,9 +1981,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 {
+@@ -1991,7 +1993,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;