pub(crate) struct WorldGenBulkSectionAccess<'region, 'world, 'profile> {
region: &'region WorldGenRegion<'world>,
chunk_cache_radius: i32,
chunks: Box<[Option<CachedWorldGenChunk<'region>>]>,
air: BlockStateId,
ore_profile: Option<&'profile RefCell<OreFeatureStats>>,
}Expand description
Cached section-level access for feature code that mirrors vanilla BulkSectionAccess.
Vanilla exposes acquired LevelChunkSections and lets some features mutate section-local
block states directly. Steel keeps chunk views cached instead of section references because
sections live behind Rust locks; callers still get the same direct section semantics without
bypassing the worldgen dependency and write-radius checks.
Fields§
§region: &'region WorldGenRegion<'world>§chunk_cache_radius: i32§chunks: Box<[Option<CachedWorldGenChunk<'region>>]>§air: BlockStateId§ore_profile: Option<&'profile RefCell<OreFeatureStats>>Implementations§
Source§impl<'region, 'world, 'profile> WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> WorldGenBulkSectionAccess<'region, 'world, 'profile>
fn new( region: &'region WorldGenRegion<'world>, ore_profile: Option<&'profile RefCell<OreFeatureStats>>, ) -> Self
pub(crate) fn record_ore_candidate_position(&mut self)
pub(crate) fn record_ore_unique_position(&mut self)
pub(crate) fn record_ore_write_allowed_position(&mut self)
pub(crate) fn ore_target_block_state(&mut self, pos: BlockPos) -> BlockStateId
pub(crate) fn ore_neighbor_block_state(&mut self, pos: BlockPos) -> BlockStateId
Sourcepub(crate) fn replace_ore_target_block_state(
&mut self,
pos: BlockPos,
replacement: impl FnOnce(BlockStateId) -> Option<BlockStateId>,
) -> bool
pub(crate) fn replace_ore_target_block_state( &mut self, pos: BlockPos, replacement: impl FnOnce(BlockStateId) -> Option<BlockStateId>, ) -> bool
Replaces an ore target block after reading it under the section write lock.
This is only suitable for ore paths that do not need neighbor reads while deciding whether the replacement is allowed.
Sourcepub(crate) fn replace_ore_target_block_states_in_section(
&mut self,
chunk_x: i32,
chunk_z: i32,
section_index: usize,
positions: &[PackedSectionBlockPos],
replacement: impl FnMut(BlockStateId) -> Option<BlockStateId>,
) -> u64
pub(crate) fn replace_ore_target_block_states_in_section( &mut self, chunk_x: i32, chunk_z: i32, section_index: usize, positions: &[PackedSectionBlockPos], replacement: impl FnMut(BlockStateId) -> Option<BlockStateId>, ) -> u64
Replaces already-filtered ore target positions that all belong to one section.
Sourcepub(crate) fn block_state(&mut self, pos: BlockPos) -> BlockStateId
pub(crate) fn block_state(&mut self, pos: BlockPos) -> BlockStateId
Reads a block state through cached section access.
Out-of-height reads return air, matching vanilla BulkSectionAccess.getBlockState.
Sourcefn section_for_read<'chunk>(
chunk: &'chunk CachedWorldGenChunk<'_>,
section_index: usize,
) -> Option<&'chunk SectionHolder>
fn section_for_read<'chunk>( chunk: &'chunk CachedWorldGenChunk<'_>, section_index: usize, ) -> Option<&'chunk SectionHolder>
Resolves the section exposed by vanilla BulkSectionAccess.
A read-only ImposterProtoChunk exposes its own empty proto sections through
getSection, even though ordinary chunk reads delegate to the wrapped Full chunk.
Sourcepub(crate) fn set_block_state(
&mut self,
pos: BlockPos,
state: BlockStateId,
) -> bool
pub(crate) fn set_block_state( &mut self, pos: BlockPos, state: BlockStateId, ) -> bool
Writes a block state directly to the containing section.
This mirrors vanilla BulkSectionAccess by skipping heightmaps, neighbor updates,
block entity callbacks, and other WorldGenRegion.setBlock side effects. Steel also
defers section block counts until light initialization, matching the rest of its
pre-light worldgen write paths.
fn writable_section_key(&self, pos: BlockPos) -> Option<WritableSectionKey>
fn set_bulk_block_state( holder: &ChunkHolder, section: &mut ChunkSection, local_x: usize, local_y: usize, local_z: usize, state: BlockStateId, ) -> BlockStateId
fn ore_section_write_guard<'section>( ore_profile: Option<&RefCell<OreFeatureStats>>, section: &'section SectionHolder, key: WritableSectionKey, ) -> SectionWriteGuard<'section>
Sourcepub(crate) const fn can_write_to_pos(&self, pos: BlockPos) -> bool
pub(crate) const fn can_write_to_pos(&self, pos: BlockPos) -> bool
Returns whether a section-local write would be allowed for this position.
fn chunk( &mut self, chunk_x: i32, chunk_z: i32, status: ChunkStatus, ) -> &CachedWorldGenChunk<'region>
fn chunk_cache_index(&self, chunk_x: i32, chunk_z: i32) -> Option<usize>
fn section_index(min_y: i32, height: i32, y: i32) -> Option<usize>
const fn local_coord(coord: i32) -> usize
fn record_ore_read_time( profile: Option<&RefCell<OreFeatureStats>>, started_at: Option<Instant>, )
fn record_ore_write_time( profile: Option<&RefCell<OreFeatureStats>>, started_at: Option<Instant>, )
fn with_ore_profile(&self, f: impl FnOnce(&mut OreFeatureStats))
fn with_ore_profile_ref( profile: Option<&RefCell<OreFeatureStats>>, f: impl FnOnce(&mut OreFeatureStats), )
Auto Trait Implementations§
impl<'region, 'world, 'profile> !RefUnwindSafe for WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> !Send for WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> !Sync for WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> !UnwindSafe for WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> Freeze for WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> Unpin for WorldGenBulkSectionAccess<'region, 'world, 'profile>
impl<'region, 'world, 'profile> UnsafeUnpin for WorldGenBulkSectionAccess<'region, 'world, 'profile>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>