Skip to main content

FlatChunkGenerator

Struct FlatChunkGenerator 

Source
pub struct FlatChunkGenerator {
    pub layers: Vec<BlockStateId>,
    biome_id: u16,
    seed: i64,
    sea_level: i32,
    structure_generator: Option<StructureGenerator>,
}
Expand description

A chunk generator that generates a flat world.

Uses a fixed biome (plains) for all positions, matching vanilla’s FlatLevelSource with FixedBiomeSource.

Fields§

§layers: Vec<BlockStateId>

Block layers from world bottom upwards.

§biome_id: u16

The biome ID for plains (cached at construction).

§seed: i64

World seed for structure placement.

§sea_level: i32

Sea level for this flat generator’s dimension type.

§structure_generator: Option<StructureGenerator>

Optional structure engine from flat structure overrides.

Implementations§

Source§

impl FlatChunkGenerator

Source

pub fn new( bedrock: BlockStateId, dirt: BlockStateId, grass: BlockStateId, ) -> Self

Creates a new FlatChunkGenerator.

Source

pub fn new_layers(layers: Vec<BlockStateId>) -> Self

Creates a new flat generator with explicit block layers from bottom upwards.

Source

pub(crate) fn new_layers_with_structures( layers: Vec<BlockStateId>, seed: i64, sea_level: i32, structure_generator: Option<StructureGenerator>, ) -> Self

Creates a flat generator with optional structure generation.

Trait Implementations§

Source§

impl ChunkGenerator for FlatChunkGenerator

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 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.
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. Read more
Source§

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

Builds the surface of the chunk. Read more
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.
Source§

fn initial_spawn_search_origin(&self) -> BlockPos

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

impl From<FlatChunkGenerator> for ChunkGeneratorType

Source§

fn from(v: FlatChunkGenerator) -> ChunkGeneratorType

Converts to this type from the input type.
Source§

impl TryInto<FlatChunkGenerator> for ChunkGeneratorType

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<FlatChunkGenerator, <Self as TryInto<FlatChunkGenerator>>::Error>

Performs the conversion.

Auto Trait Implementations§

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