3D biomes
This commit is contained in:
+4
-3
@@ -60,15 +60,16 @@ Deno.test("trees grow the wood of their kind and biome", async () => {
|
||||
for (let cx = -8; cx < 8; cx++) {
|
||||
for (let cz = -8; cz < 8; cz++) {
|
||||
const { column } = generate_raw_chunk(cx, cz, "wood-test", ids, game.world.worldgen);
|
||||
const [blocks, biomes] = [column.to_flat(), column.biomes];
|
||||
const blocks = column.to_flat();
|
||||
blocks.forEach((block, i) => {
|
||||
const leaves = leaves_of.get(block);
|
||||
if (leaves) found_leaves.add(leaves);
|
||||
const wood = wood_of.get(block);
|
||||
// the bottom of a trunk
|
||||
if (!wood || !ground.has(blocks[i - CHUNK_AREA])) return;
|
||||
const column = i % CHUNK_AREA;
|
||||
const biome = biomes[column];
|
||||
// the trunk's ground's biome
|
||||
const y = game.world.shape.min_y + Math.floor(i / CHUNK_AREA) - 1;
|
||||
const biome = column.biome_at(cx * 16 + i % 16, y, cz * 16 + Math.floor(i / 16) % 16);
|
||||
const info = get_biome(biome)!;
|
||||
const allowed = info.trees!.kinds.map((kind) =>
|
||||
info.trees!.wood[kind] ?? (kind === "big_oak" ? "oak" : kind)
|
||||
|
||||
Reference in New Issue
Block a user