resource, world: implement fallback to plains for unknown biomes

Closes #63
This commit is contained in:
Matthias Schiffer 2025-02-11 22:39:11 +01:00
parent d7fc95c950
commit a10151a4f3
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
5 changed files with 37 additions and 18 deletions

View file

@ -97,14 +97,14 @@ impl LayerEntry<'_> {
if self.is_empty() {
*self.block = Some(block_type.block_color);
if let Some(biome) = section.biomes.biome_at(section.y, coords)? {
let (biome_index, _) = biome_list.insert_full(*biome);
*self.biome = NonZeroU16::new(
(biome_index + 1)
.try_into()
.expect("biome index not in range"),
);
}
let biome = section.biomes.biome_at(section.y, coords)?;
let (biome_index, _) = biome_list.insert_full(*biome);
*self.biome = NonZeroU16::new(
(biome_index + 1)
.try_into()
.expect("biome index not in range"),
);
}
if block_type.block_color.is(BlockFlag::Water) {