diff options
| author | mat <git@matdoes.dev> | 2026-03-21 13:07:23 +0700 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2026-03-23 05:14:23 +1000 |
| commit | cac25feb6c43793a84396ac4a19e90df19d1f235 (patch) | |
| tree | 0e78bb4e88b1c2d91a86cc3a278c9d2c2a944f14 /azalea/src | |
| parent | 88606d9ce9e13fcdd4ab5ce26e52630dee614c1e (diff) | |
| download | azalea-drasl-cac25feb6c43793a84396ac4a19e90df19d1f235.tar.xz | |
cleanup and slightly speed up is_block_state_standable
Diffstat (limited to 'azalea/src')
| -rw-r--r-- | azalea/src/entity_ref/shared_impls.rs | 2 | ||||
| -rw-r--r-- | azalea/src/pathfinder/world.rs | 39 |
2 files changed, 21 insertions, 20 deletions
diff --git a/azalea/src/entity_ref/shared_impls.rs b/azalea/src/entity_ref/shared_impls.rs index 79396f56..ae3ef42a 100644 --- a/azalea/src/entity_ref/shared_impls.rs +++ b/azalea/src/entity_ref/shared_impls.rs @@ -118,7 +118,7 @@ impl_entity_functions! { /// /// This is a shortcut for `**self.component::<MinecraftEntityId>()`. EntityRef: - /// Get the Minecraft UUID of this entity. + /// Get the Minecraft ID of this entity. /// /// See [`MinecraftEntityId`] for more details. For persistent identifiers, /// consider using [`Self::uuid`] instead. diff --git a/azalea/src/pathfinder/world.rs b/azalea/src/pathfinder/world.rs index 6c5d84d2..87b62245 100644 --- a/azalea/src/pathfinder/world.rs +++ b/azalea/src/pathfinder/world.rs @@ -6,7 +6,10 @@ use std::{ sync::Arc, }; -use azalea_block::{BlockState, properties}; +use azalea_block::{ + BlockState, + properties::{self, SlabKind, StairShape}, +}; use azalea_core::{ bitset::FastFixedBitSet, position::{BlockPos, ChunkPos, ChunkSectionBlockPos}, @@ -218,32 +221,29 @@ impl CachedWorld { fn calculate_bitsets_for_section(&self, section_pos: SmallChunkSectionPos) -> CachedSection { let bitsets = self .with_section(section_pos, |section| { - let mut passable_bitset = FastFixedBitSet::<4096>::new(); - let mut solid_bitset = FastFixedBitSet::<4096>::new(); - let mut standable_bitset = FastFixedBitSet::<4096>::new(); - let mut water_bitset = FastFixedBitSet::<4096>::new(); + let mut bitsets = SectionBitsets { + passable: FastFixedBitSet::<4096>::new(), + solid: FastFixedBitSet::<4096>::new(), + standable: FastFixedBitSet::<4096>::new(), + water: FastFixedBitSet::<4096>::new(), + }; for i in 0..4096 { let block_state = section.get_at_index(i); if is_block_state_passable(block_state) { - passable_bitset.set(i); + bitsets.passable.set(i); } if is_block_state_solid(block_state) { - solid_bitset.set(i); + bitsets.solid.set(i); } if is_block_state_standable(block_state) { - standable_bitset.set(i); + bitsets.standable.set(i); } if is_block_state_water(block_state) { - water_bitset.set(i); + bitsets.water.set(i); } } - Box::new(SectionBitsets { - passable: passable_bitset, - solid: solid_bitset, - standable: standable_bitset, - water: water_bitset, - }) + Box::new(bitsets) }) .unwrap_or_default(); @@ -655,8 +655,8 @@ pub fn is_block_state_solid(block_state: BlockState) -> bool { } if matches!( - block_state.property::<properties::Type>(), - Some(properties::Type::Top | properties::Type::Double) + block_state.property::<properties::SlabKind>(), + Some(properties::SlabKind::Top | properties::SlabKind::Double) ) { // top slabs return true; @@ -683,8 +683,9 @@ pub fn is_block_state_standable(block_state: BlockState) -> bool { return true; } - let block = BlockKind::from(block_state); - if tags::blocks::SLABS.contains(&block) || tags::blocks::STAIRS.contains(&block) { + if block_state.property::<SlabKind>().is_some() + || block_state.property::<StairShape>().is_some() + { return true; } |
