diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index 1fd9494f40..1521d5c8d5 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -257,7 +257,7 @@ + player.setRealHealth(f); + } + -+ this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(player.getScaledHealth())); ++ player.updateScaledHealth(); + return; + } + // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 20059b9456..1866d5210f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1382,9 +1382,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { injectScaledMaxHealth(set, true); + // SPIGOT-3813: Attributes before health + if (getHandle().playerConnection != null) { + getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(getHandle().getId(), set)); + sendHealthUpdate(); + } getHandle().getDataWatcher().set(EntityLiving.HEALTH, (float) getScaledHealth()); - sendHealthUpdate(); - getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(getHandle().getId(), set)); getHandle().maxHealthCache = getMaxHealth(); }