1#![doc = include_str!("../README.md")]
2
3mod behavior;
4pub mod block_state;
5pub mod fluid_state;
6mod generated;
7mod range;
8
9use core::fmt::Debug;
10use std::any::Any;
11
12pub use behavior::BlockBehavior;
13pub use block_state::BlockState;
15pub use generated::{blocks, properties};
16pub use range::BlockStates;
17
18pub trait Block: Debug + Any {
19 fn behavior(&self) -> BlockBehavior;
20 fn id(&self) -> &'static str;
23 fn as_block_state(&self) -> BlockState;
26 fn as_registry_block(&self) -> azalea_registry::Block;
29}
30impl dyn Block {
31 pub fn downcast_ref<T: Block>(&self) -> Option<&T> {
32 (self as &dyn Any).downcast_ref::<T>()
33 }
34}
35
36pub trait Property {
37 type Value;
38
39 fn try_from_block_state(state: BlockState) -> Option<Self::Value>;
40}