Add Serverbound Player Command
This commit is contained in:
1 parent
81f82a41b7
commit
d1c3b2f10c
11 files changed
+138
-88
No files matched your search
@@ -17,6 +17,8 @@ serde_json = "1.0"
|
||||
|
||||
thiserror = "1.0.63"
|
||||
log = "0.4"
|
||||
num-traits = "0.2"
|
||||
num-derive = "0.4"
|
||||
|
||||
# for text component
|
||||
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
use num_derive::FromPrimitive;
|
||||
use num_traits::FromPrimitive;
|
||||
|
||||
use crate::{ServerPacket, VarInt};
|
||||
|
||||
pub struct SConfirmTeleport {
|
||||
@@ -48,6 +51,35 @@ impl ServerPacket for SPlayerPosition {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SPlayerCommand {
|
||||
pub entitiy_id: VarInt,
|
||||
pub action: Action,
|
||||
pub jump_boost: VarInt,
|
||||
}
|
||||
#[derive(FromPrimitive)]
|
||||
pub enum Action {
|
||||
StartSneaking = 0,
|
||||
StopSneaking,
|
||||
LeaveBed,
|
||||
StartSprinting,
|
||||
StopSprinting,
|
||||
StartHourseJump,
|
||||
OpenVehicleInventory,
|
||||
StartFlyingElytra,
|
||||
}
|
||||
|
||||
impl ServerPacket for SPlayerCommand {
|
||||
const PACKET_ID: VarInt = 0x25;
|
||||
|
||||
fn read(bytebuf: &mut crate::bytebuf::ByteBuffer) -> Self {
|
||||
Self {
|
||||
entitiy_id: bytebuf.get_var_int(),
|
||||
action: Action::from_i32(bytebuf.get_var_int()).unwrap(),
|
||||
jump_boost: bytebuf.get_var_int(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SPlayerPositionRotation {
|
||||
pub x: f64,
|
||||
pub feet_y: f64,
|
||||
|
||||
Reference in new issue
Block a user