aboutsummaryrefslogtreecommitdiff
path: root/azalea-core
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-08 23:45:15 -0500
committermat <github@matdoes.dev>2022-05-08 23:45:15 -0500
commit345cecf7afa84df2d5ecf075ecfb499e3fd10a55 (patch)
tree4657aebf820aab0e934cc501fcbb822d5ef2c84f /azalea-core
parent122693a654b0c851bbb9e134c539961419175bef (diff)
downloadazalea-drasl-345cecf7afa84df2d5ecf075ecfb499e3fd10a55.tar.xz
add more stuff
Diffstat (limited to 'azalea-core')
-rw-r--r--azalea-core/src/position.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/azalea-core/src/position.rs b/azalea-core/src/position.rs
index a57f5c0b..a2292651 100644
--- a/azalea-core/src/position.rs
+++ b/azalea-core/src/position.rs
@@ -23,6 +23,15 @@ impl ChunkPos {
}
}
+impl From<BlockPos> for ChunkPos {
+ fn from(pos: BlockPos) -> Self {
+ ChunkPos {
+ x: pos.x / 16,
+ z: pos.z / 16,
+ }
+ }
+}
+
#[derive(Clone, Copy, Debug, Default)]
pub struct ChunkSectionPos {
pub x: i32,
@@ -35,3 +44,19 @@ impl ChunkSectionPos {
ChunkSectionPos { x, y, z }
}
}
+
+impl From<BlockPos> for ChunkSectionPos {
+ fn from(pos: BlockPos) -> Self {
+ ChunkSectionPos {
+ x: pos.x / 16,
+ y: pos.y / 16,
+ z: pos.z / 16,
+ }
+ }
+}
+
+impl From<ChunkSectionPos> for ChunkPos {
+ fn from(pos: ChunkSectionPos) -> Self {
+ ChunkPos { x: pos.x, z: pos.z }
+ }
+}