diff options
| author | mat <git@matdoes.dev> | 2025-08-10 11:06:31 -1345 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-08-10 14:21:34 -1030 |
| commit | 827277555d44c606b16df91e1e724f3f0ab9e0a8 (patch) | |
| tree | fdc3803b322f6df07c2e052251cb59eed3575a5d /azalea-core/src | |
| parent | 5bd7a4b11a37670a093fb68e0f5fb6fe8246191e (diff) | |
| download | azalea-drasl-827277555d44c606b16df91e1e724f3f0ab9e0a8.tar.xz | |
use Vec3f32 in entity metadata to fix parsing Vector3 values
Diffstat (limited to 'azalea-core/src')
| -rw-r--r-- | azalea-core/src/position.rs | 26 |
1 files changed, 26 insertions, 0 deletions
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<Vec3f32> 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<Vec3> 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. |
