Skip to main content

steel_core/worldgen/generator/
empty.rs

1use crate::chunk::Chunk;
2use crate::worldgen::generator::{
3    ChunkGenerator, GenerationChunk, TerrainPhase, xoroshiro_worldgen_region_random,
4};
5use crate::worldgen::region::WorldGenRegion;
6use glam::IVec3;
7use steel_registry::{biome::BiomeRef, vanilla_biomes};
8use steel_utils::ChunkPos;
9use steel_utils::random::RandomSource;
10use steel_worldgen::noise::Beardifier;
11
12/// A chunk generator that generates an empty world.
13#[derive(Default)]
14pub struct EmptyChunkGenerator;
15
16impl EmptyChunkGenerator {
17    const MIN_Y: i32 = 0;
18    const HEIGHT: i32 = 384;
19
20    /// Creates a new `EmptyWorld`.
21    #[must_use]
22    pub const fn new() -> Self {
23        Self {}
24    }
25}
26
27impl ChunkGenerator for EmptyChunkGenerator {
28    fn min_y(&self) -> i32 {
29        Self::MIN_Y
30    }
31
32    fn gen_depth(&self) -> i32 {
33        Self::HEIGHT
34    }
35
36    fn noise_biome(&self, _quart_x: i32, _quart_y: i32, _quart_z: i32) -> BiomeRef {
37        &vanilla_biomes::PLAINS
38    }
39
40    fn create_structures(&self, _chunk: &Chunk) {}
41
42    fn create_biomes(&self, _chunk: &Chunk) {}
43
44    fn fill_from_noise(
45        &self,
46        _chunk: GenerationChunk<'_, TerrainPhase>,
47        _beardifier: Option<&Beardifier>,
48    ) {
49    }
50
51    fn build_surface(
52        &self,
53        _chunk: GenerationChunk<'_, TerrainPhase>,
54        _neighbor_biomes: &dyn Fn(IVec3) -> u16,
55    ) {
56    }
57
58    fn apply_carvers(&self, _chunk: GenerationChunk<'_, TerrainPhase>) {}
59
60    fn create_worldgen_region_random(&self, world_seed: i64, center: ChunkPos) -> RandomSource {
61        xoroshiro_worldgen_region_random(world_seed, center)
62    }
63
64    fn apply_biome_decorations(&self, _region: &mut WorldGenRegion<'_>) {}
65}