Fix: Place block on correct side

This commit is contained in:
lukas0008 committed 2024-08-17 20:40:26 +02:00
1 parent 94748859c6
commit fdb94d43fa
2 files changed
+21 -4

No files matched your search

+16
View File
@@ -1,5 +1,7 @@
use num_derive::FromPrimitive;
use crate::vector3::Vector3;
pub mod block_registry;
#[derive(FromPrimitive)]
@@ -11,3 +13,17 @@ pub enum BlockFace {
West,
East,
}
impl BlockFace {
pub fn to_offset(&self) -> Vector3<i32> {
match self {
BlockFace::Bottom => (0, -1, 0),
BlockFace::East => (1, 0, 0),
BlockFace::North => (0, 0, -1),
BlockFace::South => (0, 0, 1),
BlockFace::Top => (0, 1, 0),
BlockFace::West => (-1, 0, 0),
}
.into()
}
}