pub struct GenerationContext<'ctx, 'src, N: DimensionNoises>where
'src: 'ctx,{Show 20 fields
seed: i64,
chunk_x: i32,
chunk_z: i32,
chunk_min_x: i32,
chunk_min_z: i32,
center_block_x: i32,
center_block_z: i32,
sea_level: i32,
surface_y_cache: &'ctx mut Option<i32>,
height_cache_grid_ready: &'ctx mut bool,
noises: &'src N,
splitter: &'src RandomSplitter,
template_pools: &'src FxHashMap<Identifier, TemplatePoolData>,
templates: &'src FxHashMap<Identifier, TemplateData>,
biome_sampler: &'ctx mut ChunkBiomeSampler<'src>,
height_cache: &'ctx mut N::ColumnCache,
aquifer: &'ctx mut LazyAquifer<'src, N>,
terrain_height_cache: RefCell<FxHashMap<(i32, i32, bool), i32>>,
terrain_opaque_cache: RefCell<FxHashMap<(i32, i32, i32, bool), bool>>,
terrain_probes: RefCell<FxHashMap<(i32, i32), TerrainProbe<N>>>,
}Expand description
Per-chunk context shared by every structure’s findGenerationPoint.
Holds mutable per-chunk state (biome sampler, height cache, aquifer) so structures
don’t each allocate their own. Wraps VanillaGenerator’s helpers.
Fields§
§seed: i64World seed.
chunk_x: i32Chunk being populated.
chunk_z: i32Chunk being populated.
chunk_min_x: i32chunk_x * 16.
chunk_min_z: i32chunk_z * 16.
center_block_x: i32chunk_min_x + 8.
center_block_z: i32chunk_min_z + 8.
sea_level: i32Sea level for this dimension.
surface_y_cache: &'ctx mut Option<i32>Shared memoisation slot for the chunk-center surface Y.
height_cache_grid_ready: &'ctx mut boolWhether height_cache’s 5×5 quart grid has been populated. Shared across
per-structure contexts in the same chunk.
noises: &'src NDimension noise router.
splitter: &'src RandomSplitterPositional splitter for per-chunk RNG.
template_pools: &'src FxHashMap<Identifier, TemplatePoolData>Template pool registry for jigsaw assembly.
templates: &'src FxHashMap<Identifier, TemplateData>Template data registry for jigsaw assembly.
biome_sampler: &'ctx mut ChunkBiomeSampler<'src>Biome sampler scoped to this chunk.
height_cache: &'ctx mut N::ColumnCacheColumn cache for height/density queries (grid-initialized on demand).
aquifer: &'ctx mut LazyAquifer<'src, N>Aquifer built on first query; skipped on chunks where no structure needs it.
terrain_height_cache: RefCell<FxHashMap<(i32, i32, bool), i32>>Cache for terrain height checks.
terrain_opaque_cache: RefCell<FxHashMap<(i32, i32, i32, bool), bool>>Cache for terrain opacity checks.
terrain_probes: RefCell<FxHashMap<(i32, i32), TerrainProbe<N>>>Probes for off-chunk height/opaque checks.
Implementations§
Source§impl<'ctx, 'src, N: DimensionNoises> GenerationContext<'ctx, 'src, N>where
'src: 'ctx,
impl<'ctx, 'src, N: DimensionNoises> GenerationContext<'ctx, 'src, N>where
'src: 'ctx,
Sourcepub fn new(
seed: i64,
chunk_x: i32,
chunk_z: i32,
sea_level: i32,
noises: &'src N,
splitter: &'src RandomSplitter,
template_pools: &'src FxHashMap<Identifier, TemplatePoolData>,
templates: &'src FxHashMap<Identifier, TemplateData>,
biome_sampler: &'ctx mut ChunkBiomeSampler<'src>,
height_cache: &'ctx mut N::ColumnCache,
aquifer: &'ctx mut LazyAquifer<'src, N>,
surface_y_cache: &'ctx mut Option<i32>,
height_cache_grid_ready: &'ctx mut bool,
) -> Self
pub fn new( seed: i64, chunk_x: i32, chunk_z: i32, sea_level: i32, noises: &'src N, splitter: &'src RandomSplitter, template_pools: &'src FxHashMap<Identifier, TemplatePoolData>, templates: &'src FxHashMap<Identifier, TemplateData>, biome_sampler: &'ctx mut ChunkBiomeSampler<'src>, height_cache: &'ctx mut N::ColumnCache, aquifer: &'ctx mut LazyAquifer<'src, N>, surface_y_cache: &'ctx mut Option<i32>, height_cache_grid_ready: &'ctx mut bool, ) -> Self
Creates a per-chunk structure generation context.
Sourcepub fn base_height(&mut self, x: i32, z: i32, ocean_floor: bool) -> i32
pub fn base_height(&mut self, x: i32, z: i32, ocean_floor: bool) -> i32
getBaseHeight(WORLD_SURFACE_WG) — aquifer-aware, scans from
preliminary_surface_level + 16.
ocean_floor=false → opaque is Solid+Fluid; true → opaque is Solid only.
In dimensions with a constant preliminary_surface_level (End), use
base_height_full instead.
Sourcepub fn base_height_full(&mut self, x: i32, z: i32, ocean_floor: bool) -> i32
pub fn base_height_full(&mut self, x: i32, z: i32, ocean_floor: bool) -> i32
Full-column scan from chunk top. Matches vanilla’s iterateNoiseColumn.
Sourcepub fn biome_at(&mut self, block_x: i32, block_y: i32, block_z: i32) -> BiomeRef
pub fn biome_at(&mut self, block_x: i32, block_y: i32, block_z: i32) -> BiomeRef
Biome at a block position (quantized to quart).
Sourcepub fn column_state(&mut self, x: i32, y: i32, z: i32) -> ColumnBlock
pub fn column_state(&mut self, x: i32, y: i32, z: i32) -> ColumnBlock
Classify a single block in the base-noise column.
Sourcepub fn solid_block_below_air(
&mut self,
x: i32,
z: i32,
start_y: i32,
min_solid_y: i32,
) -> Option<i32>
pub fn solid_block_below_air( &mut self, x: i32, z: i32, start_y: i32, min_solid_y: i32, ) -> Option<i32>
Highest solid base-terrain block directly below air in [min_solid_y, start_y).
Sourcepub fn surface_y(&mut self) -> i32
pub fn surface_y(&mut self) -> i32
Surface Y at chunk center, memoised across per-structure contexts.
fn ensure_height_cache_grid(&mut self)
Trait Implementations§
Source§impl<N: DimensionNoises> StructureGenerationContext for GenerationContext<'_, '_, N>
impl<N: DimensionNoises> StructureGenerationContext for GenerationContext<'_, '_, N>
Source§fn chunk_min_x(&self) -> i32
fn chunk_min_x(&self) -> i32
Source§fn chunk_min_z(&self) -> i32
fn chunk_min_z(&self) -> i32
Source§fn center_block_x(&self) -> i32
fn center_block_x(&self) -> i32
Source§fn center_block_z(&self) -> i32
fn center_block_z(&self) -> i32
Source§fn template_pools(&self) -> &FxHashMap<Identifier, TemplatePoolData>
fn template_pools(&self) -> &FxHashMap<Identifier, TemplatePoolData>
Source§fn templates(&self) -> &FxHashMap<Identifier, TemplateData>
fn templates(&self) -> &FxHashMap<Identifier, TemplateData>
Source§fn base_height_full(&mut self, x: i32, z: i32, ocean_floor: bool) -> i32
fn base_height_full(&mut self, x: i32, z: i32, ocean_floor: bool) -> i32
Source§fn biome_at(&mut self, block_x: i32, block_y: i32, block_z: i32) -> BiomeRef
fn biome_at(&mut self, block_x: i32, block_y: i32, block_z: i32) -> BiomeRef
Source§fn column_state(&mut self, x: i32, y: i32, z: i32) -> ColumnBlock
fn column_state(&mut self, x: i32, y: i32, z: i32) -> ColumnBlock
Source§fn solid_block_below_air(
&mut self,
x: i32,
z: i32,
start_y: i32,
min_solid_y: i32,
) -> Option<i32>
fn solid_block_below_air( &mut self, x: i32, z: i32, start_y: i32, min_solid_y: i32, ) -> Option<i32>
[min_solid_y, start_y).Source§fn terrain_surface_height(&self, x: i32, z: i32, ocean_floor: bool) -> i32
fn terrain_surface_height(&self, x: i32, z: i32, ocean_floor: bool) -> i32
Auto Trait Implementations§
impl<'ctx, 'src, N> !Freeze for GenerationContext<'ctx, 'src, N>
impl<'ctx, 'src, N> !RefUnwindSafe for GenerationContext<'ctx, 'src, N>
impl<'ctx, 'src, N> !Sync for GenerationContext<'ctx, 'src, N>
impl<'ctx, 'src, N> !UnwindSafe for GenerationContext<'ctx, 'src, N>
impl<'ctx, 'src, N> Send for GenerationContext<'ctx, 'src, N>
impl<'ctx, 'src, N> Unpin for GenerationContext<'ctx, 'src, N>
impl<'ctx, 'src, N> UnsafeUnpin for GenerationContext<'ctx, 'src, N>
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<>>