diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index df39b5f00b..8ed9d4c0dc 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -39,6 +39,7 @@ import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.network.chat.PlayerChatMessage; import net.minecraft.network.protocol.game.ClientboundClearTitlesPacket; import net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket; +import net.minecraft.network.protocol.game.ClientboundHurtAnimationPacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; import net.minecraft.network.protocol.game.ClientboundSetBorderCenterPacket; @@ -840,6 +841,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().connection.send(packet); } + @Override + public void sendHurtAnimation(float yaw) { + if (getHandle().connection == null) { + return; + } + + /* + * Vanilla degrees state that 0 = left, 90 = front, 180 = right, and 270 = behind. + * This makes no sense. We'll add 90 to it so that 0 = front, clockwise from there. + */ + float actualYaw = yaw + 90; + getHandle().connection.send(new ClientboundHurtAnimationPacket(getEntityId(), actualYaw)); + } + @Override public void addCustomChatCompletions(Collection completions) { this.sendCustomChatCompletionPacket(completions, ClientboundCustomChatCompletionsPacket.Action.ADD);