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-world/src | |
| 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-world/src')
| -rw-r--r-- | azalea-world/src/chunk_storage.rs | 2 | ||||
| -rw-r--r-- | azalea-world/src/container.rs | 3 | ||||
| -rw-r--r-- | azalea-world/src/find_blocks.rs | 17 | ||||
| -rw-r--r-- | azalea-world/src/heightmap.rs | 4 | ||||
| -rw-r--r-- | azalea-world/src/palette/container.rs | 2 | ||||
| -rw-r--r-- | azalea-world/src/world.rs | 2 |
6 files changed, 16 insertions, 14 deletions
diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index 35d8cac3..f8646209 100644 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -15,7 +15,7 @@ use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; use azalea_core::position::{ BlockPos, ChunkBiomePos, ChunkBlockPos, ChunkPos, ChunkSectionBiomePos, ChunkSectionBlockPos, }; -use azalea_registry::Biome; +use azalea_registry::data::Biome; use nohash_hasher::IntMap; use parking_lot::RwLock; use tracing::{debug, trace, warn}; diff --git a/azalea-world/src/container.rs b/azalea-world/src/container.rs index ff79ec81..3e167085 100644 --- a/azalea-world/src/container.rs +++ b/azalea-world/src/container.rs @@ -3,7 +3,8 @@ use std::{ sync::{Arc, Weak}, }; -use azalea_core::{identifier::Identifier, registry_holder::RegistryHolder}; +use azalea_core::registry_holder::RegistryHolder; +use azalea_registry::identifier::Identifier; use bevy_ecs::{component::Component, resource::Resource}; use derive_more::{Deref, DerefMut}; use nohash_hasher::IntMap; diff --git a/azalea-world/src/find_blocks.rs b/azalea-world/src/find_blocks.rs index 17e66754..5edf3ea2 100644 --- a/azalea-world/src/find_blocks.rs +++ b/azalea-world/src/find_blocks.rs @@ -10,11 +10,12 @@ impl Instance { /// performance purposes. /// /// ``` + /// # use azalea_registry::builtin::BlockKind; /// # fn example(client: &azalea_client::Client) { /// client /// .world() /// .read() - /// .find_block(client.position(), &azalea_registry::Block::Chest.into()); + /// .find_block(client.position(), &BlockKind::Chest.into()); /// # } /// ``` pub fn find_block( @@ -249,7 +250,7 @@ fn palette_maybe_has_block(palette: &Palette<BlockState>, block_states: &BlockSt #[cfg(test)] mod tests { - use azalea_registry::Block; + use azalea_registry::builtin::BlockKind; use super::*; use crate::{Chunk, PartialChunkStorage}; @@ -274,10 +275,10 @@ mod tests { chunk_storage, ); - chunk_storage.set_block_state(BlockPos { x: 17, y: 0, z: 0 }, Block::Stone.into()); - chunk_storage.set_block_state(BlockPos { x: 0, y: 18, z: 0 }, Block::Stone.into()); + chunk_storage.set_block_state(BlockPos { x: 17, y: 0, z: 0 }, BlockKind::Stone.into()); + chunk_storage.set_block_state(BlockPos { x: 0, y: 18, z: 0 }, BlockKind::Stone.into()); - let pos = instance.find_block(BlockPos { x: 0, y: 0, z: 0 }, &Block::Stone.into()); + let pos = instance.find_block(BlockPos { x: 0, y: 0, z: 0 }, &BlockKind::Stone.into()); assert_eq!(pos, Some(BlockPos { x: 17, y: 0, z: 0 })); } @@ -301,10 +302,10 @@ mod tests { chunk_storage, ); - chunk_storage.set_block_state(BlockPos { x: -1, y: 0, z: 0 }, Block::Stone.into()); - chunk_storage.set_block_state(BlockPos { x: 15, y: 0, z: 0 }, Block::Stone.into()); + chunk_storage.set_block_state(BlockPos { x: -1, y: 0, z: 0 }, BlockKind::Stone.into()); + chunk_storage.set_block_state(BlockPos { x: 15, y: 0, z: 0 }, BlockKind::Stone.into()); - let pos = instance.find_block(BlockPos { x: 0, y: 0, z: 0 }, &Block::Stone.into()); + let pos = instance.find_block(BlockPos { x: 0, y: 0, z: 0 }, &BlockKind::Stone.into()); assert_eq!(pos, Some(BlockPos { x: -1, y: 0, z: 0 })); } } diff --git a/azalea-world/src/heightmap.rs b/azalea-world/src/heightmap.rs index d3b2b071..0f5e4c53 100644 --- a/azalea-world/src/heightmap.rs +++ b/azalea-world/src/heightmap.rs @@ -3,7 +3,7 @@ use std::{ str::FromStr, }; -use azalea_block::BlockState; +use azalea_block::{BlockState, BlockTrait}; use azalea_buf::AzBuf; use azalea_core::{math, position::ChunkBlockPos}; use azalea_registry::tags::blocks::LEAVES; @@ -45,7 +45,7 @@ fn motion_blocking(block_state: BlockState) -> bool { impl HeightmapKind { pub fn is_opaque(self, block_state: BlockState) -> bool { - let block = Box::<dyn azalea_block::BlockTrait>::from(block_state); + let block = Box::<dyn BlockTrait>::from(block_state); let registry_block = block.as_registry_block(); match self { HeightmapKind::WorldSurfaceWg => !block_state.is_air(), diff --git a/azalea-world/src/palette/container.rs b/azalea-world/src/palette/container.rs index 4e5b4489..a10c5d78 100644 --- a/azalea-world/src/palette/container.rs +++ b/azalea-world/src/palette/container.rs @@ -6,7 +6,7 @@ use std::{ use azalea_block::BlockState; use azalea_buf::{AzaleaRead, AzaleaWrite, BufReadError}; use azalea_core::position::{ChunkSectionBiomePos, ChunkSectionBlockPos}; -use azalea_registry::Biome; +use azalea_registry::data::Biome; use tracing::{debug, warn}; use super::{Palette, PaletteKind}; diff --git a/azalea-world/src/world.rs b/azalea-world/src/world.rs index 969b7d36..c9833c64 100644 --- a/azalea-world/src/world.rs +++ b/azalea-world/src/world.rs @@ -11,7 +11,7 @@ use azalea_core::{ position::{BlockPos, ChunkPos}, registry_holder::RegistryHolder, }; -use azalea_registry::Biome; +use azalea_registry::data::Biome; use bevy_ecs::{component::Component, entity::Entity}; use derive_more::{Deref, DerefMut}; use nohash_hasher::IntMap; |
