diff options
| author | mat <github@matdoes.dev> | 2022-06-16 23:38:51 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-06-16 23:38:51 -0500 |
| commit | 74c3ae52f84d988b8bf3f0affe143d2cd2d8143a (patch) | |
| tree | f4755ffe59e7f5feac34569b788c92f7a88b9489 /azalea-block/block-macros/src | |
| parent | 4f89f70091962c967a7022e6f293f11a446abc3c (diff) | |
| download | azalea-drasl-74c3ae52f84d988b8bf3f0affe143d2cd2d8143a.tar.xz | |
azalea-world uses azalea-block
Diffstat (limited to 'azalea-block/block-macros/src')
| -rw-r--r-- | azalea-block/block-macros/src/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/azalea-block/block-macros/src/lib.rs b/azalea-block/block-macros/src/lib.rs index d38062d4..6206bb65 100644 --- a/azalea-block/block-macros/src/lib.rs +++ b/azalea-block/block-macros/src/lib.rs @@ -461,9 +461,12 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { block_structs.extend(block_struct); } + let last_state_id = (state_id - 1) as u32; quote! { #property_enums + #[repr(u32)] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum BlockState { #block_state_enum_variants } @@ -479,6 +482,15 @@ pub fn make_block_states(input: TokenStream) -> TokenStream { } } } + + impl BlockState { + /// Returns the highest possible state + #[inline] + pub fn max_state() -> u32 { + #last_state_id + } + } + } .into() } |
