diff options
| author | mat <git@matdoes.dev> | 2025-06-02 17:56:16 -0800 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-06-02 17:56:16 -0800 |
| commit | 1edb9d34486b432c84351692aa82a3c0328a7d69 (patch) | |
| tree | d3f456e52772074849d42131fb65e4d50f390c5a /azalea-core/src | |
| parent | f3a5e91a8ccbcd03a239aa3565dbfddabb26fa76 (diff) | |
| download | azalea-drasl-1edb9d34486b432c84351692aa82a3c0328a7d69.tar.xz | |
add BlockPos::center_bottom
Diffstat (limited to 'azalea-core/src')
| -rw-r--r-- | azalea-core/src/position.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs index beb8eedb..7cb8b143 100644 --- a/azalea-core/src/position.rs +++ b/azalea-core/src/position.rs @@ -358,6 +358,16 @@ impl BlockPos { } } + /// Get the center of the bottom of a block position by adding 0.5 to the x + /// and z coordinates. + pub fn center_bottom(&self) -> Vec3 { + Vec3 { + x: self.x as f64 + 0.5, + y: self.y as f64, + z: self.z as f64 + 0.5, + } + } + /// Convert the block position into a Vec3 without centering it. pub fn to_vec3_floored(&self) -> Vec3 { Vec3 { |
