#[repr(transparent)]pub struct GenerationChunk<'a, Phase> {
chunk: &'a Chunk,
phase: PhantomData<fn() -> Phase>,
}Expand description
Stage-scoped access to the center chunk being generated.
The scheduler constructs this capability only after the chunk’s input status is
published. It deliberately does not expose the underlying Chunk or its raw
section storage, so status-sensitive writes stay tied to the operation that owns
them.
use steel_core::worldgen::generator::{GenerationChunk, NoisePhase};
fn write_surface_column_during_noise(chunk: GenerationChunk<'_, NoisePhase>) {
chunk.write_column(0, 0, &[]);
}Fields§
§chunk: &'a Chunk§phase: PhantomData<fn() -> Phase>Implementations§
Source§impl<'a, Phase> GenerationChunk<'a, Phase>
impl<'a, Phase> GenerationChunk<'a, Phase>
const fn from_chunk(chunk: &'a Chunk) -> Self
fn acquire_input(holder: &'a ChunkHolder, input_status: ChunkStatus) -> Self
Sourcepub fn section_count(self) -> usize
pub fn section_count(self) -> usize
Returns the number of vertical chunk sections.
Sourcepub fn get_relative_block(
self,
relative_x: usize,
relative_y: usize,
relative_z: usize,
) -> Option<BlockStateId>
pub fn get_relative_block( self, relative_x: usize, relative_y: usize, relative_z: usize, ) -> Option<BlockStateId>
Reads one block using coordinates relative to the dimension’s minimum Y.
Sourcepub fn get_block_state(self, pos: BlockPos) -> BlockStateId
pub fn get_block_state(self, pos: BlockPos) -> BlockStateId
Reads one block at a world position.
Source§impl GenerationChunk<'_, NoisePhase>
impl GenerationChunk<'_, NoisePhase>
pub(crate) fn acquire(holder: &ChunkHolder) -> GenerationChunk<'_, NoisePhase>
Sourcepub fn write_block_batch(self, blocks: &[(usize, usize, usize, BlockStateId)])
pub fn write_block_batch(self, blocks: &[(usize, usize, usize, BlockStateId)])
Writes a Noise-stage block batch using the published Biomes semantics.
Sourcepub fn replace_noise_heightmaps(
self,
ocean_floor: Heightmap,
world_surface: Heightmap,
)
pub fn replace_noise_heightmaps( self, ocean_floor: Heightmap, world_surface: Heightmap, )
Replaces the two heightmaps initialized directly by terrain noise filling.
§Panics
Panics if either heightmap has a type other than its corresponding noise-stage type.
Sourcepub fn install_post_noise_state<T>(self, state: T)
pub fn install_post_noise_state<T>(self, state: T)
Installs generator-owned state for reuse by Surface and Carvers.
Sourcepub fn mark_pos_for_postprocessing(self, pos: BlockPos)
pub fn mark_pos_for_postprocessing(self, pos: BlockPos)
Marks a position for Vanilla generation postprocessing.
Sourcepub fn set_relative_block(
self,
relative_x: usize,
relative_y: usize,
relative_z: usize,
state: BlockStateId,
)
pub fn set_relative_block( self, relative_x: usize, relative_y: usize, relative_z: usize, state: BlockStateId, )
Writes one block using the published Biomes semantics.
Source§impl GenerationChunk<'_, SurfacePhase>
impl GenerationChunk<'_, SurfacePhase>
pub(crate) fn acquire(holder: &ChunkHolder) -> GenerationChunk<'_, SurfacePhase>
Sourcepub fn prime_world_surface_heightmap(self)
pub fn prime_world_surface_heightmap(self)
Ensures the world-surface worldgen heightmap exists.
Sourcepub fn with_post_noise_state_mut<T, R>(
self,
f: impl FnOnce(&mut T) -> R,
) -> Option<R>
pub fn with_post_noise_state_mut<T, R>( self, f: impl FnOnce(&mut T) -> R, ) -> Option<R>
Borrows generator-owned state retained after Noise.
Sourcepub fn read_all_biomes(self) -> Box<[u16]>
pub fn read_all_biomes(self) -> Box<[u16]>
Copies every biome palette entry in section order.
Sourcepub fn read_column_into(
self,
local_x: usize,
local_z: usize,
output: &mut Vec<BlockStateId>,
)
pub fn read_column_into( self, local_x: usize, local_z: usize, output: &mut Vec<BlockStateId>, )
Reads one complete block column into output.
Sourcepub fn world_surface_height_at(self, local_x: usize, local_z: usize) -> i32
pub fn world_surface_height_at(self, local_x: usize, local_z: usize) -> i32
Reads the world-surface worldgen height, lazily priming it if needed.
Sourcepub fn write_column(
self,
local_x: usize,
local_z: usize,
blocks: &[(usize, BlockStateId)],
)
pub fn write_column( self, local_x: usize, local_z: usize, blocks: &[(usize, BlockStateId)], )
Writes one Surface-stage column and applies its Noise-input heightmap effects.
Sourcepub fn set_relative_block(
self,
relative_x: usize,
relative_y: usize,
relative_z: usize,
state: BlockStateId,
)
pub fn set_relative_block( self, relative_x: usize, relative_y: usize, relative_z: usize, state: BlockStateId, )
Writes one block using the published Noise semantics.
Source§impl GenerationChunk<'_, CarversPhase>
impl GenerationChunk<'_, CarversPhase>
pub(crate) fn acquire(holder: &ChunkHolder) -> GenerationChunk<'_, CarversPhase>
Sourcepub fn prime_world_surface_heightmap(self)
pub fn prime_world_surface_heightmap(self)
Ensures the world-surface worldgen heightmap exists.
Sourcepub fn clear_post_noise_state(self)
pub fn clear_post_noise_state(self)
Drops retained generator state without running Carvers.
Sourcepub fn consume_post_noise_state<T, R>(
self,
f: impl FnOnce(Option<&mut T>) -> R,
) -> R
pub fn consume_post_noise_state<T, R>( self, f: impl FnOnce(Option<&mut T>) -> R, ) -> R
Consumes generator-owned state retained after Noise.
Sourcepub fn with_carving_mask<R>(self, f: impl FnOnce(&mut CarvingMask) -> R) -> R
pub fn with_carving_mask<R>(self, f: impl FnOnce(&mut CarvingMask) -> R) -> R
Runs f with the chunk’s lazily initialized carving mask.
Sourcepub fn set_block_state(self, pos: BlockPos, state: BlockStateId)
pub fn set_block_state(self, pos: BlockPos, state: BlockStateId)
Sets one carved block using the published Surface semantics.
Sourcepub fn with_world_surface_heightmap<R>(
self,
f: impl FnOnce(&Heightmap) -> R,
) -> Option<R>
pub fn with_world_surface_heightmap<R>( self, f: impl FnOnce(&Heightmap) -> R, ) -> Option<R>
Runs f with the world-surface worldgen heightmap if priming provides it.
Sourcepub fn mark_pos_for_postprocessing(self, pos: BlockPos)
pub fn mark_pos_for_postprocessing(self, pos: BlockPos)
Marks a position for Vanilla generation postprocessing.
Trait Implementations§
Source§impl<Phase> Clone for GenerationChunk<'_, Phase>
impl<Phase> Clone for GenerationChunk<'_, Phase>
impl<Phase> Copy for GenerationChunk<'_, Phase>
Auto Trait Implementations§
impl<'a, Phase> !RefUnwindSafe for GenerationChunk<'a, Phase>
impl<'a, Phase> !UnwindSafe for GenerationChunk<'a, Phase>
impl<'a, Phase> Freeze for GenerationChunk<'a, Phase>
impl<'a, Phase> Send for GenerationChunk<'a, Phase>
impl<'a, Phase> Sync for GenerationChunk<'a, Phase>
impl<'a, Phase> Unpin for GenerationChunk<'a, Phase>
impl<'a, Phase> UnsafeUnpin for GenerationChunk<'a, Phase>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<>>