diff options
author | Lizzy Fleckenstein <eliasfleckenstein@web.de> | 2023-02-08 02:46:10 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <eliasfleckenstein@web.de> | 2023-02-08 02:46:10 +0100 |
commit | 79c91a91bbeb40533d5e837fc094f96c3d086a08 (patch) | |
tree | ededea2bcc941f9fd94237a3964d8b7ef3b6bead /src/to_srv.rs | |
parent | 7b96b333d786c17d6d3093ffa8886ae145bfa9a6 (diff) | |
download | mt_ser-79c91a91bbeb40533d5e837fc094f96c3d086a08.tar.xz |
derive serialization for structs
Diffstat (limited to 'src/to_srv.rs')
-rw-r--r-- | src/to_srv.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/to_srv.rs b/src/to_srv.rs index 354bbb4..e83a8b8 100644 --- a/src/to_srv.rs +++ b/src/to_srv.rs @@ -1,12 +1,26 @@ use crate::*; +#[mt_derive(to = "srv", repr = "u32", enumset)] +pub enum Key { + Forward, + Backward, + Left, + Right, + Jump, + Special, + Sneak, + Dig, + Place, + Zoom, +} + #[mt_derive(to = "srv")] pub struct PlayerPos { - #[mt(const_u16 = 1)] // supported compression pub pos_100: [i32; 3], pub vel_100: [i32; 3], pub pitch_100: i32, pub yaw_100: i32, + pub keys: EnumSet<Key>, pub fov_80: u8, pub wanted_range: u8, } @@ -29,7 +43,7 @@ pub enum ToSrvPkt { Nil = 0, Init { serialize_version: u8, - #[mt(const_u16 = 1)] // supported compression + #[mt(const16 = 1)] // supported compression min_proto_version: u16, max_proto_version: u16, player_name: String, @@ -76,7 +90,7 @@ pub enum ToSrvPkt { Interact { action: Interaction, item_slot: u16, - #[mt(size_u32)] + #[mt(size32)] pointed: PointedThing, pos: PlayerPos, } = 57, |