aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-core/src')
-rwxr-xr-xazalea-core/src/delta.rs1
-rwxr-xr-xazalea-core/src/particle/mod.rs1
-rwxr-xr-xazalea-core/src/position.rs14
-rwxr-xr-xazalea-core/src/resource_location.rs3
4 files changed, 17 insertions, 2 deletions
diff --git a/azalea-core/src/delta.rs b/azalea-core/src/delta.rs
index 4f730d14..ce49ab50 100755
--- a/azalea-core/src/delta.rs
+++ b/azalea-core/src/delta.rs
@@ -39,6 +39,7 @@ impl PositionDeltaTrait for PositionDelta8 {
}
impl Vec3 {
+ #[must_use]
pub fn with_delta(&self, delta: &dyn PositionDeltaTrait) -> Vec3 {
Vec3 {
x: self.x + delta.x(),
diff --git a/azalea-core/src/particle/mod.rs b/azalea-core/src/particle/mod.rs
index 44c7c2f5..8dc9f8c6 100755
--- a/azalea-core/src/particle/mod.rs
+++ b/azalea-core/src/particle/mod.rs
@@ -1,6 +1,7 @@
use crate::{BlockPos, Slot};
use azalea_buf::McBuf;
+#[cfg_attr(feature = "bevy_ecs", derive(bevy_ecs::component::Component))]
#[derive(Debug, Clone, McBuf, Default)]
pub struct Particle {
#[var]
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index ea54c60c..d04f58cc 100755
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -1,5 +1,5 @@
use crate::ResourceLocation;
-use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
+use azalea_buf::{BufReadError, McBuf, McBufReadable, McBufWritable};
use std::{
io::{Cursor, Write},
ops::{Add, AddAssign, Mul, Rem, Sub},
@@ -109,7 +109,7 @@ macro_rules! vec3_impl {
};
}
-#[derive(Clone, Copy, Debug, Default, PartialEq)]
+#[derive(Clone, Copy, Debug, Default, PartialEq, McBuf)]
pub struct Vec3 {
pub x: f64,
pub y: f64,
@@ -270,12 +270,22 @@ impl From<&Vec3> for BlockPos {
}
}
}
+impl From<Vec3> for BlockPos {
+ fn from(pos: Vec3) -> Self {
+ BlockPos::from(&pos)
+ }
+}
impl From<&Vec3> for ChunkPos {
fn from(pos: &Vec3) -> Self {
ChunkPos::from(&BlockPos::from(pos))
}
}
+impl From<Vec3> for ChunkPos {
+ fn from(pos: Vec3) -> Self {
+ ChunkPos::from(&pos)
+ }
+}
const PACKED_X_LENGTH: u64 = 1 + 25; // minecraft does something a bit more complicated to get this 25
const PACKED_Z_LENGTH: u64 = PACKED_X_LENGTH;
diff --git a/azalea-core/src/resource_location.rs b/azalea-core/src/resource_location.rs
index e810b96e..4e25d00e 100755
--- a/azalea-core/src/resource_location.rs
+++ b/azalea-core/src/resource_location.rs
@@ -3,6 +3,9 @@
use azalea_buf::{BufReadError, McBufReadable, McBufWritable};
use std::io::{Cursor, Write};
+// TODO: make a `resourcelocation!("minecraft:overwolrd")` macro that checks if
+// it's correct at compile-time.
+
#[derive(Hash, Clone, PartialEq, Eq)]
pub struct ResourceLocation {
pub namespace: String,