Skip to main content

WorldGenBulkSectionAccess

Struct WorldGenBulkSectionAccess 

Source
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>

Source

fn new( region: &'region WorldGenRegion<'world>, ore_profile: Option<&'profile RefCell<OreFeatureStats>>, ) -> Self

Source

pub(crate) fn record_ore_candidate_position(&mut self)

Source

pub(crate) fn record_ore_unique_position(&mut self)

Source

pub(crate) fn record_ore_write_allowed_position(&mut self)

Source

pub(crate) fn ore_target_block_state(&mut self, pos: BlockPos) -> BlockStateId

Source

pub(crate) fn ore_neighbor_block_state(&mut self, pos: BlockPos) -> BlockStateId

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn writable_section_key(&self, pos: BlockPos) -> Option<WritableSectionKey>

Source

fn set_bulk_block_state( holder: &ChunkHolder, section: &mut ChunkSection, local_x: usize, local_y: usize, local_z: usize, state: BlockStateId, ) -> BlockStateId

Source

fn ore_section_write_guard<'section>( ore_profile: Option<&RefCell<OreFeatureStats>>, section: &'section SectionHolder, key: WritableSectionKey, ) -> SectionWriteGuard<'section>

Source

pub(crate) const fn can_write_to_pos(&self, pos: BlockPos) -> bool

Returns whether a section-local write would be allowed for this position.

Source

fn chunk( &mut self, chunk_x: i32, chunk_z: i32, status: ChunkStatus, ) -> &CachedWorldGenChunk<'region>

Source

fn chunk_cache_index(&self, chunk_x: i32, chunk_z: i32) -> Option<usize>

Source

fn section_index(min_y: i32, height: i32, y: i32) -> Option<usize>

Source

const fn local_coord(coord: i32) -> usize

Source

fn record_ore_read_time( profile: Option<&RefCell<OreFeatureStats>>, started_at: Option<Instant>, )

Source

fn record_ore_write_time( profile: Option<&RefCell<OreFeatureStats>>, started_at: Option<Instant>, )

Source

fn with_ore_profile(&self, f: impl FnOnce(&mut OreFeatureStats))

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more