Skip to main content

ChunkGenerator

Trait ChunkGenerator 

Source
pub trait ChunkGenerator: Send + Sync {
Show 13 methods // Required methods fn min_y(&self) -> i32; fn gen_depth(&self) -> i32; fn noise_biome(&self, quart_x: i32, quart_y: i32, quart_z: i32) -> BiomeRef; fn create_structures(&self, chunk: &Chunk); fn create_biomes(&self, chunk: &Chunk); fn fill_from_noise( &self, chunk: GenerationChunk<'_, NoisePhase>, beardifier: Option<&Beardifier>, ); fn build_surface( &self, chunk: GenerationChunk<'_, SurfacePhase>, neighbor_biomes: &dyn Fn(IVec3) -> u16, ); fn apply_carvers(&self, chunk: GenerationChunk<'_, CarversPhase>); fn create_worldgen_region_random( &self, world_seed: i64, center: ChunkPos, ) -> RandomSource; fn apply_biome_decorations(&self, region: &mut WorldGenRegion<'_>); // Provided methods fn initial_spawn_search_origin(&self) -> BlockPos { ... } fn spawn_height(&self, min_y: i32, _height: i32) -> i32 { ... } fn structure_generator(&self) -> Option<&StructureGenerator> { ... }
}
Expand description

A trait for generating chunks.

Required Methods§

Source

fn min_y(&self) -> i32

Returns the generator’s minimum Y coordinate.

Source

fn gen_depth(&self) -> i32

Returns the generator’s vertical generation depth in blocks.

Source

fn noise_biome(&self, quart_x: i32, quart_y: i32, quart_z: i32) -> BiomeRef

Returns the generator biome at one quart position without requiring a loaded chunk.

Source

fn create_structures(&self, chunk: &Chunk)

Creates the structures in a chunk.

Source

fn create_biomes(&self, chunk: &Chunk)

Creates the biomes in a chunk.

Source

fn fill_from_noise( &self, chunk: GenerationChunk<'_, NoisePhase>, beardifier: Option<&Beardifier>, )

Fills the chunk with noise.

beardifier carries pre-collected structure-piece terrain adaptation. The caller (production: noise stage; tests: harness) is responsible for walking the chunk’s structure references and building the beardifier — this trait stays free of any cross-chunk lookup. None skips the integration entirely (cheaper than passing an empty beardifier).

Source

fn build_surface( &self, chunk: GenerationChunk<'_, SurfacePhase>, neighbor_biomes: &dyn Fn(IVec3) -> u16, )

Builds the surface of the chunk.

neighbor_biomes maps (quart_x, quart_y, quart_z) to a biome palette ID, reading from neighbor chunk palettes for out-of-chunk biome lookups (matching vanilla’s WorldGenRegion.getNoiseBiome).

Source

fn apply_carvers(&self, chunk: GenerationChunk<'_, CarversPhase>)

Applies carvers to the chunk.

Source

fn create_worldgen_region_random( &self, world_seed: i64, center: ChunkPos, ) -> RandomSource

Creates the per-region random source exposed by vanilla WorldGenRegion.getRandom().

Source

fn apply_biome_decorations(&self, region: &mut WorldGenRegion<'_>)

Applies structure piece placement and biome feature decorations.

Provided Methods§

Source

fn initial_spawn_search_origin(&self) -> BlockPos

Returns the climate-selected origin used by vanilla before searching for a safe spawn chunk.

Source

fn spawn_height(&self, min_y: i32, _height: i32) -> i32

Returns the generator-provided spawn height used before falling back to the surface heightmap.

Source

fn structure_generator(&self) -> Option<&StructureGenerator>

Returns the structure generator used for placement and locate queries.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§