Skip to main content

steel_core/worldgen/generator/
empty.rs

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