mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
animate packet
This commit is contained in:
parent
7c742347a7
commit
d783a0295b
3 changed files with 25 additions and 0 deletions
|
@ -322,6 +322,9 @@ impl Client {
|
||||||
GamePacket::ClientboundBlockUpdatePacket(p) => {
|
GamePacket::ClientboundBlockUpdatePacket(p) => {
|
||||||
println!("Got block update packet {:?}", p);
|
println!("Got block update packet {:?}", p);
|
||||||
}
|
}
|
||||||
|
GamePacket::ClientboundAnimatePacket(p) => {
|
||||||
|
println!("Got animate packet {:?}", p);
|
||||||
|
}
|
||||||
_ => panic!("Unexpected packet {:?}", packet),
|
_ => panic!("Unexpected packet {:?}", packet),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
pub mod clientbound_add_entity_packet;
|
pub mod clientbound_add_entity_packet;
|
||||||
pub mod clientbound_add_mob_packet;
|
pub mod clientbound_add_mob_packet;
|
||||||
pub mod clientbound_add_player_packet;
|
pub mod clientbound_add_player_packet;
|
||||||
|
pub mod clientbound_animate_packet;
|
||||||
pub mod clientbound_block_update_packet;
|
pub mod clientbound_block_update_packet;
|
||||||
pub mod clientbound_change_difficulty_packet;
|
pub mod clientbound_change_difficulty_packet;
|
||||||
pub mod clientbound_chat_packet;
|
pub mod clientbound_chat_packet;
|
||||||
|
@ -55,6 +56,7 @@ declare_state_packets!(
|
||||||
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
|
0x00: clientbound_add_entity_packet::ClientboundAddEntityPacket,
|
||||||
0x02: clientbound_add_mob_packet::ClientboundAddMobPacket,
|
0x02: clientbound_add_mob_packet::ClientboundAddMobPacket,
|
||||||
0x04: clientbound_add_player_packet::ClientboundAddPlayerPacket,
|
0x04: clientbound_add_player_packet::ClientboundAddPlayerPacket,
|
||||||
|
0x6: clientbound_animate_packet::ClientboundAnimatePacket,
|
||||||
0xc: clientbound_block_update_packet::ClientboundBlockUpdatePacket,
|
0xc: clientbound_block_update_packet::ClientboundBlockUpdatePacket,
|
||||||
0x0e: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
|
0x0e: clientbound_change_difficulty_packet::ClientboundChangeDifficultyPacket,
|
||||||
0xf: clientbound_chat_packet::ClientboundChatPacket,
|
0xf: clientbound_chat_packet::ClientboundChatPacket,
|
||||||
|
|
Loading…
Add table
Reference in a new issue