aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/position.rs
diff options
context:
space:
mode:
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.