Add BlockFace

This commit is contained in:
Snowiiii committed 2024-08-17 11:14:38 +02:00
1 parent 91533c30df
commit 40fe40355f
8 files changed
+25 -7

No files matched your search

+3
View File
@@ -16,3 +16,6 @@ flate2 = "1.0.31"
serde = { version = "1.0.205", features = ["derive"] }
lazy_static = "1.5.0"
serde_json = "1.0.122"
num-traits = "0.2"
num-derive = "0.4"
@@ -4,7 +4,7 @@ use lazy_static::lazy_static;
use crate::world::WorldError;
const BLOCKS_JSON: &str = include_str!("../assets/blocks.json");
const BLOCKS_JSON: &str = include_str!("../../assets/blocks.json");
#[derive(serde::Deserialize, Debug, Clone, PartialEq, Eq)]
struct BlockDefinition {
+13
View File
@@ -0,0 +1,13 @@
use num_derive::FromPrimitive;
pub mod block_registry;
#[derive(FromPrimitive)]
pub enum BlockFace {
Bottom = 0,
Top,
North,
South,
West,
East,
}
+1 -1
View File
@@ -92,7 +92,7 @@ impl ChunkData {
.palette
.iter()
.map(|entry| {
crate::block_registry::block_id_and_properties_to_block_state_id(
crate::block::block_registry::block_id_and_properties_to_block_state_id(
&entry.name,
entry.properties.as_ref(),
)
+1 -1
View File
@@ -3,6 +3,6 @@ pub mod dimension;
pub const WORLD_HEIGHT: usize = 384;
pub const WORLD_Y_START_AT: i32 = -64;
pub const DIRECT_PALETTE_BITS: u32 = 15;
mod block_registry;
mod block;
pub mod radial_chunk_iterator;
mod world;