aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-08 18:44:40 -0500
committermat <github@matdoes.dev>2022-05-08 18:44:40 -0500
commitd783a0295b11c32f1b5425cab2461f9297f7f8fa (patch)
tree28f337e3beb2fd97c85883abfef244a4c6a7f771 /azalea-protocol/src
parent7c742347a7e16ac28fcc88e3bab30e68695763e4 (diff)
downloadazalea-drasl-d783a0295b11c32f1b5425cab2461f9297f7f8fa.tar.xz
animate packet
Diffstat (limited to 'azalea-protocol/src')
-rw-r--r--azalea-protocol/src/packets/game/clientbound_animate_packet.rs20
-rwxr-xr-xazalea-protocol/src/packets/game/mod.rs2
2 files changed, 22 insertions, 0 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_animate_packet.rs b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs
new file mode 100644
index 00000000..84a20381
--- /dev/null
+++ b/azalea-protocol/src/packets/game/clientbound_animate_packet.rs
@@ -0,0 +1,20 @@
+use packet_macros::{GamePacket, McBufReadable, McBufWritable};
+
+#[derive(Clone, Debug, GamePacket)]
+pub struct ClientboundAnimatePacket {
+ #[var]
+ pub id: u32,
+ pub action: AnimationAction,
+}
+
+// minecraft actually uses a u8 for this, but a varint still works and makes it
+// so i don't have to add a special handler
+#[derive(Clone, Debug, Copy, McBufReadable, McBufWritable)]
+pub enum AnimationAction {
+ SwingMainHand = 0,
+ Hurt = 1,
+ WakeUp = 2,
+ SwingOffHand = 3,
+ CriticalHit = 4,
+ MagicCriticalHit = 5,
+}
diff --git a/azalea-protocol/src/packets/game/mod.rs b/azalea-protocol/src/packets/game/mod.rs
index 64818638..0391ee10 100755
--- a/azalea-protocol/src/packets/game/mod.rs
+++ b/azalea-protocol/src/packets/game/mod.rs
@@ -1,6 +1,7 @@
pub mod clientbound_add_entity_packet;
pub mod clientbound_add_mob_packet;
pub mod clientbound_add_player_packet;
+pub mod clientbound_animate_packet;
pub mod clientbound_block_update_packet;
pub mod clientbound_change_difficulty_packet;
pub mod clientbound_chat_packet;
@@ -55,6 +56,7 @@ declare_state_packets!(
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
0x02: clientbound_add_mob_packet::ClientboundAddMobPacket,
0x04: clientbound_add_player_packet::ClientboundAddPlayerPacket,
+ 0x6: clientbound_animate_packet::ClientboundAnimatePacket,
0xc: clientbound_block_update_packet::ClientboundBlockUpdatePacket,
0x0e: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
0xf: clientbound_chat_packet::ClientboundChatPacket,