3D biomes
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
// docs/modding/worldgen/terrain.md. tests/worldgen_golden_test.ts checks the base game's makes the same world
|
||||
import { assert, assertEquals, assertRejects } from "@std/assert";
|
||||
import { generate_raw_chunk } from "@/common/generation.ts";
|
||||
import { CHUNK_AREA } from "@/common/constants.ts";
|
||||
import { copy_dir, test_game } from "./helpers.ts";
|
||||
|
||||
// mods/bworld and a mod with files, in a temp folder
|
||||
@@ -55,15 +56,15 @@ Deno.test("a mod's biome generates where its rule, added to the base game's, say
|
||||
for (let cz = -2; cz < 2; cz++) {
|
||||
const { column } = generate_raw_chunk(cx, cz, "lavender", block_ids, worldgen, default_values);
|
||||
const { min_y, max_y } = game.world.shape;
|
||||
column.biomes.forEach((biome, i) => {
|
||||
if (biome !== "lavender:fields") return;
|
||||
fields++;
|
||||
// its surface: the top block of the column is its sand
|
||||
for (let i = 0; i < CHUNK_AREA; i++) {
|
||||
const [x, z] = [cx * 16 + i % 16, cz * 16 + Math.floor(i / 16)];
|
||||
// its surface: the top block of the column is its sand
|
||||
let y = max_y - 1;
|
||||
while (y > min_y && column.get(x, y, z) === 0) y--;
|
||||
if (column.biome_at(x, y, z) !== "lavender:fields") continue;
|
||||
fields++;
|
||||
assertEquals(column.get(x, y, z), block_ids["bworld:sand"]);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(fields > 100, `only ${fields} columns of lavender fields`);
|
||||
|
||||
Reference in New Issue
Block a user