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§
Sourcefn noise_biome(&self, quart_x: i32, quart_y: i32, quart_z: i32) -> BiomeRef
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.
Sourcefn create_structures(&self, chunk: &Chunk)
fn create_structures(&self, chunk: &Chunk)
Creates the structures in a chunk.
Sourcefn create_biomes(&self, chunk: &Chunk)
fn create_biomes(&self, chunk: &Chunk)
Creates the biomes in a chunk.
Sourcefn fill_from_noise(
&self,
chunk: GenerationChunk<'_, NoisePhase>,
beardifier: Option<&Beardifier>,
)
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).
Sourcefn build_surface(
&self,
chunk: GenerationChunk<'_, SurfacePhase>,
neighbor_biomes: &dyn Fn(IVec3) -> u16,
)
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).
Sourcefn apply_carvers(&self, chunk: GenerationChunk<'_, CarversPhase>)
fn apply_carvers(&self, chunk: GenerationChunk<'_, CarversPhase>)
Applies carvers to the chunk.
Sourcefn create_worldgen_region_random(
&self,
world_seed: i64,
center: ChunkPos,
) -> RandomSource
fn create_worldgen_region_random( &self, world_seed: i64, center: ChunkPos, ) -> RandomSource
Creates the per-region random source exposed by vanilla WorldGenRegion.getRandom().
Sourcefn apply_biome_decorations(&self, region: &mut WorldGenRegion<'_>)
fn apply_biome_decorations(&self, region: &mut WorldGenRegion<'_>)
Applies structure piece placement and biome feature decorations.
Provided Methods§
Sourcefn initial_spawn_search_origin(&self) -> BlockPos
fn initial_spawn_search_origin(&self) -> BlockPos
Returns the climate-selected origin used by vanilla before searching for a safe spawn chunk.
Sourcefn spawn_height(&self, min_y: i32, _height: i32) -> i32
fn spawn_height(&self, min_y: i32, _height: i32) -> i32
Returns the generator-provided spawn height used before falling back to the surface heightmap.
Sourcefn structure_generator(&self) -> Option<&StructureGenerator>
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".