From 85d55e42119ea80cd1cd9e9e34c05ea7d07b3a88 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Tue, 28 Feb 2023 18:08:41 +0100 Subject: Use cgmath and support BS constant --- src/to_clt.rs | 56 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'src/to_clt.rs') diff --git a/src/to_clt.rs b/src/to_clt.rs index dae59ac..90af326 100644 --- a/src/to_clt.rs +++ b/src/to_clt.rs @@ -76,7 +76,10 @@ pub enum ToCltPkt { username: String, } = 2, AcceptAuth { - player_pos: [f32; 3], + #[mt(multiplier = "BS")] + #[mt(map_ser = "|x| Ok(x + Vector3::new(0.0, 0.5, 0.0) * BS)")] + #[mt(map_des = "|x: Point3| Ok(x - Vector3::new(0.0, 0.5, 0.0) * BS)")] + player_pos: Point3, map_seed: u64, send_interval: f32, sudo_auth_methods: EnumSet, @@ -88,12 +91,12 @@ pub enum ToCltPkt { DenySudoMode = 5, Kick(KickReason) = 10, BlockData { - pos: [i16; 3], + pos: Point3, #[mt(zstd)] block: Box, } = 32, AddNode { - pos: [i16; 3], + pos: Point3, param0: u16, param1: u8, param2: u8, @@ -115,7 +118,8 @@ pub enum ToCltPkt { map_range: u32, } = 42, AddPlayerVelocity { - vel: [f32; 3], + #[mt(multiplier = "BS")] + vel: Vector3, } = 43, MediaPush { raw_hash: String, @@ -146,22 +150,24 @@ pub enum ToCltPkt { damage_effect: bool, } = 51, MovePlayer { - pos: [f32; 3], - pitch: f32, - yaw: f32, + #[mt(multiplier = "BS")] + pos: Point3, + pitch: Deg, + yaw: Deg, } = 52, LegacyKick { #[mt(len = "Utf16")] reason: String, } = 53, Fov { - fov: f32, + fov: Deg, multiplier: bool, transition_time: f32, } = 54, DeathScreen { point_cam: bool, - point_at: [f32; 3], + #[mt(multiplier = "BS")] + point_at: Point3, } = 55, Media { n: u16, @@ -186,7 +192,8 @@ pub enum ToCltPkt { name: String, gain: f32, source: SoundSource, - pos: [f32; 3], + #[mt(multiplier = "BS")] + pos: Point3, src_obj_id: u16, #[serde(rename = "loop")] sound_loop: bool, @@ -231,9 +238,9 @@ pub enum ToCltPkt { gravity: f32, } = 69, SpawnParticle { - pos: [f32; 3], - vel: [f32; 3], - acc: [f32; 3], + pos: Point3, + vel: Vector3, + acc: Vector3, expiration_time: f32, size: f32, collide: bool, @@ -248,12 +255,13 @@ pub enum ToCltPkt { node_param2: u8, node_tile: u8, } = 70, + // TODO: support new particlespawner definitions (with tweening) AddParticleSpawner { amount: u16, duration: f32, - pos: RangeInclusive<[f32; 3]>, - vel: RangeInclusive<[f32; 3]>, - acc: RangeInclusive<[f32; 3]>, + pos: RangeInclusive>, + vel: RangeInclusive>, + acc: RangeInclusive>, expiration_time: RangeInclusive, size: RangeInclusive, collide: bool, @@ -296,15 +304,17 @@ pub enum ToCltPkt { ratio: u16, } = 80, LocalPlayerAnim { - idle: [i32; 2], - walk: [i32; 2], - dig: [i32; 2], - walk_dig: [i32; 2], + idle: RangeInclusive, + walk: RangeInclusive, + dig: RangeInclusive, + walk_dig: RangeInclusive, speed: f32, } = 81, EyeOffset { - first: [f32; 3], - third: [f32; 3], + #[mt(multiplier = "BS")] + first: Vector3, + #[mt(multiplier = "BS")] + third: Vector3, } = 82, RemoveParticleSpawner { id: u32, @@ -331,7 +341,7 @@ pub enum ToCltPkt { NodeMetasChanged { #[mt(size = "u32", zlib)] #[mt(len = "NodeMetasLen")] - changed: HashMap<[i16; 3], NodeMeta>, + changed: HashMap, NodeMeta>, } = 89, SunParams(SunParams) = 90, MoonParams(MoonParams) = 91, -- cgit v1.2.3