mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
#1157: Add Player#sendHurtAnimation()
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
609f8055d2
commit
f8dd2656fa
1 changed files with 15 additions and 0 deletions
|
@ -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<String> completions) {
|
||||
this.sendCustomChatCompletionPacket(completions, ClientboundCustomChatCompletionsPacket.Action.ADD);
|
||||
|
|
Loading…
Reference in a new issue