Skip to content

Commit

Permalink
Derive Deserialize & Serialize for BlockPos & Vec3
Browse files Browse the repository at this point in the history
(cherry picked from commit f0d15d0)
  • Loading branch information
ShayBox committed Oct 21, 2024
1 parent 2992fc6 commit 9c659b6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions azalea-core/src/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! for entity positions and block positions, respectively.
use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::{
fmt,
hash::Hash,
Expand Down Expand Up @@ -211,6 +213,7 @@ macro_rules! vec3_impl {
/// Used to represent an exact position in the world where an entity could be.
/// For blocks, [`BlockPos`] is used instead.
#[derive(Clone, Copy, Debug, Default, PartialEq, McBuf)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct Vec3 {
pub x: f64,
pub y: f64,
Expand All @@ -235,6 +238,7 @@ impl Vec3 {
/// The coordinates of a block in the world. For entities (if the coordinate
/// with decimals), use [`Vec3`] instead.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub struct BlockPos {
pub x: i32,
pub y: i32,
Expand Down

0 comments on commit 9c659b6

Please sign in to comment.