aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/position.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-06-17 09:30:09 +1200
committermat <git@matdoes.dev>2025-06-16 21:31:04 +0000
commitfd9bf168716f195e7e6225b93dfb099aa01b1fde (patch)
treee617f464e2df32cbc8678b56c5c1df8cae1c4dcb /azalea-core/src/position.rs
parent713dae7110ad4119469323b87fd95a7f2a544ed0 (diff)
downloadazalea-drasl-fd9bf168716f195e7e6225b93dfb099aa01b1fde.tar.xz
implement EntityHitResult
Diffstat (limited to 'azalea-core/src/position.rs')
-rw-r--r--azalea-core/src/position.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index 5a8d3e0c..c0c25639 100644
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -350,6 +350,12 @@ impl Vec3 {
z: self.z.ceil() as i32,
}
}
+
+ /// Whether the distance between this point and `other` is less than
+ /// `range`.
+ pub fn closer_than(&self, other: Vec3, range: f64) -> bool {
+ self.distance_squared_to(other) < range.powi(2)
+ }
}
/// The coordinates of a block in the world.