diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-12 00:56:02 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-12 00:56:02 -0600 |
| commit | f9c25665c203d6377ace62f1e95381d037d8fd9e (patch) | |
| tree | 8b4131d20fe661d3cc1175ec27f801fe61df41ea /azalea-block/src/block_state.rs | |
| parent | 82ad975242292d5875780b4398b62637674bf50a (diff) | |
| download | azalea-drasl-f9c25665c203d6377ace62f1e95381d037d8fd9e.tar.xz | |
Refactor azalea-registry (#294)
* move registries in azalea-registry into separate modules
* rename Item and Block to ItemKind and BlockKind
* remove 'extra' registries from azalea-registry
* hide deprecated items from docs
* use DamageKindKey instead of Identifier when parsing registries
* store tag entries as a Vec instead of a HashSet
* sort tag values by protocol id
* update changelog
Diffstat (limited to 'azalea-block/src/block_state.rs')
| -rw-r--r-- | azalea-block/src/block_state.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/azalea-block/src/block_state.rs b/azalea-block/src/block_state.rs index e3f894bf..d39961b3 100644 --- a/azalea-block/src/block_state.rs +++ b/azalea-block/src/block_state.rs @@ -4,6 +4,7 @@ use std::{ }; use azalea_buf::{AzaleaRead, AzaleaReadVar, AzaleaWrite, AzaleaWriteVar, BufReadError}; +use azalea_registry::builtin::BlockKind; use crate::BlockTrait; @@ -129,7 +130,7 @@ impl Debug for BlockState { } } -impl From<BlockState> for azalea_registry::Block { +impl From<BlockState> for BlockKind { fn from(value: BlockState) -> Self { Box::<dyn BlockTrait>::from(value).as_registry_block() } @@ -156,22 +157,16 @@ mod tests { assert_eq!(block.id(), "air"); let block: Box<dyn BlockTrait> = - Box::<dyn BlockTrait>::from(BlockState::from(azalea_registry::Block::FloweringAzalea)); + Box::<dyn BlockTrait>::from(BlockState::from(BlockKind::FloweringAzalea)); assert_eq!(block.id(), "flowering_azalea"); } #[test] fn test_debug_blockstate() { - let formatted = format!( - "{:?}", - BlockState::from(azalea_registry::Block::FloweringAzalea) - ); + let formatted = format!("{:?}", BlockState::from(BlockKind::FloweringAzalea)); assert!(formatted.ends_with(", FloweringAzalea)"), "{}", formatted); - let formatted = format!( - "{:?}", - BlockState::from(azalea_registry::Block::BigDripleafStem) - ); + let formatted = format!("{:?}", BlockState::from(BlockKind::BigDripleafStem)); assert!( formatted.ends_with(", BigDripleafStem { facing: North, waterlogged: false })"), "{}", |
