Add Player swing animation
This commit is contained in:
1 parent
bb6e3d9478
commit
0cec9bf216
9 files changed
+69
-159
No files matched your search
@@ -0,0 +1,31 @@
|
||||
use num_derive::ToPrimitive;
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[packet(0x03)]
|
||||
pub struct CEntityAnimation {
|
||||
entity_id: VarInt,
|
||||
/// See `Animation`
|
||||
animation: u8,
|
||||
}
|
||||
|
||||
impl CEntityAnimation {
|
||||
pub fn new(entity_id: VarInt, animation: u8) -> Self {
|
||||
Self {
|
||||
entity_id,
|
||||
animation,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(ToPrimitive)]
|
||||
pub enum Animation {
|
||||
SwingMainArm,
|
||||
LeaveBed,
|
||||
SwingOffhand,
|
||||
CriticalEffect,
|
||||
MagicCriticaleffect,
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[packet(0x38)]
|
||||
pub struct CPlayerAbilities {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
mod c_change_difficulty;
|
||||
mod c_chunk_data_update_light;
|
||||
mod c_entity_animation;
|
||||
mod c_entity_metadata;
|
||||
mod c_game_event;
|
||||
mod c_head_rot;
|
||||
@@ -19,6 +20,7 @@ mod player_action;
|
||||
|
||||
pub use c_change_difficulty::*;
|
||||
pub use c_chunk_data_update_light::*;
|
||||
pub use c_entity_animation::*;
|
||||
pub use c_entity_metadata::*;
|
||||
pub use c_game_event::*;
|
||||
pub use c_head_rot::*;
|
||||
|
||||
@@ -51,6 +51,20 @@ impl ServerPacket for SPlayerPosition {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SSwingArm {
|
||||
pub hand: VarInt,
|
||||
}
|
||||
|
||||
impl ServerPacket for SSwingArm {
|
||||
const PACKET_ID: VarInt = VarInt(0x36);
|
||||
|
||||
fn read(bytebuf: &mut crate::bytebuf::ByteBuffer) -> Self {
|
||||
Self {
|
||||
hand: bytebuf.get_var_int(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SPlayerCommand {
|
||||
pub entitiy_id: VarInt,
|
||||
pub action: Action,
|
||||
|
||||
Reference in new issue
Block a user