aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/position.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2024-12-24 08:48:36 +0000
committermat <git@matdoes.dev>2024-12-24 08:48:36 +0000
commitf03e0c22355778a9863cccb5a59d852278d60701 (patch)
treef02e7ca3d1e975d486071934a6322d372b7c9a02 /azalea-core/src/position.rs
parentde5a53ce08de5b9d77bce99dd9ecde3171ebd74e (diff)
downloadazalea-drasl-f03e0c22355778a9863cccb5a59d852278d60701.tar.xz
fix parsing Dust particle and treat waterlogged blocks as liquid in pathfinder
Diffstat (limited to 'azalea-core/src/position.rs')
-rwxr-xr-xazalea-core/src/position.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index be06e825..ab73c0d1 100755
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -71,6 +71,7 @@ macro_rules! vec3_impl {
/// Return a new instance of this position with the z coordinate subtracted
/// by the given number.
+ #[inline]
pub fn north(&self, z: $type) -> Self {
Self {
x: self.x,
@@ -80,6 +81,7 @@ macro_rules! vec3_impl {
}
/// Return a new instance of this position with the x coordinate increased
/// by the given number.
+ #[inline]
pub fn east(&self, x: $type) -> Self {
Self {
x: self.x + x,
@@ -89,6 +91,7 @@ macro_rules! vec3_impl {
}
/// Return a new instance of this position with the z coordinate increased
/// by the given number.
+ #[inline]
pub fn south(&self, z: $type) -> Self {
Self {
x: self.x,
@@ -98,6 +101,7 @@ macro_rules! vec3_impl {
}
/// Return a new instance of this position with the x coordinate subtracted
/// by the given number.
+ #[inline]
pub fn west(&self, x: $type) -> Self {
Self {
x: self.x - x,
@@ -110,6 +114,16 @@ macro_rules! vec3_impl {
pub fn dot(&self, other: Self) -> $type {
self.x * other.x + self.y * other.y + self.z * other.z
}
+
+ /// Replace the Y with 0.
+ #[inline]
+ pub fn xz(&self) -> Self {
+ Self {
+ x: self.x,
+ y: <$type>::default(),
+ z: self.z,
+ }
+ }
}
impl Add for &$name {