3D biomes

This commit is contained in:
2026-11-07 12:13:43 -03:00
parent b726ce9695
commit 22191d260c
53 changed files with 874 additions and 316 deletions
+2 -2
View File
@@ -125,11 +125,11 @@ export class NaturalSpawner {
if (Math.hypot(world_spawn.x - fx, world_spawn.y - y, world_spawn.z - fz) < MIN_DISTANCE) continue;
if (!world.has_chunk(Math.floor(x / CHUNK_SIZE), Math.floor(z / CHUNK_SIZE))) continue;
if (!spawn) {
spawn = this.#pick(world.biome_at(x, z));
spawn = this.#pick(world.biome_at(x, y, z));
if (!spawn) break;
size = spawn.min_count + this.#int(spawn.max_count - spawn.min_count + 1);
}
if (distance > MAX_DISTANCE || !spawns_in(spawn, world.biome_at(x, z))) continue;
if (distance > MAX_DISTANCE || !spawns_in(spawn, world.biome_at(x, y, z))) continue;
// in loaded chunks only, the light too, so trying never builds a chunk
if (!world.has_chunks_around(x, z, LIGHT_REACH)) continue;
if (!is_spawn_ground(world, x, y - 1, z)) continue;