From 827277555d44c606b16df91e1e724f3f0ab9e0a8 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 10 Aug 2025 11:06:31 -1345 Subject: use Vec3f32 in entity metadata to fix parsing Vector3 values --- azalea-core/src/position.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'azalea-core/src') diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index 8ba381a5..9aebd80b 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -361,6 +361,32 @@ impl Vec3 { } } +/// A lower precision [`Vec3`], used for some fields in entity metadata. +#[derive(Clone, Copy, Debug, Default, PartialEq, AzBuf)] +pub struct Vec3f32 { + pub x: f32, + pub y: f32, + pub z: f32, +} +impl From for Vec3 { + fn from(v: Vec3f32) -> Self { + Vec3 { + x: v.x as f64, + y: v.y as f64, + z: v.z as f64, + } + } +} +impl From for Vec3f32 { + fn from(v: Vec3) -> Self { + Vec3f32 { + x: v.x as f32, + y: v.y as f32, + z: v.z as f32, + } + } +} + /// The coordinates of a block in the world. /// /// For entities (if the coordinates are floating-point), use [`Vec3`] instead. -- cgit v1.2.3