Improve a buuuunch of textures and some reworks

This commit is contained in:
2026-09-27 18:05:20 -03:00
parent 9f47c709f1
commit b7ded817d9
186 changed files with 1486 additions and 124 deletions
+11 -3
View File
@@ -5,6 +5,7 @@ import { AIR, CHUNK_AREA, CHUNK_HEIGHT, CHUNK_SIZE, ID_MASK } from "$/common/con
import type { FeatureChunk } from "$/common/mod_api/worldgen.ts";
import type { OreJson } from "$/common/mod_data.ts";
import { generate_overworld } from "./worldgen/overworld.ts";
import { type Wood, WOODS } from "./worldgen/trees.ts";
import { named_noise_2d, named_noise_3d } from "./worldgen/noise.ts";
export { named_noise_2d, named_noise_3d };
@@ -29,6 +30,8 @@ export interface RawChunk {
blocks: Uint32Array;
// blocks it generated in other chunks (from features like a mod's trees), flattened as x, y, z, numeric id
spills: Int32Array;
// each column's biome id, x then z
biomes: string[];
}
// features that threw, so each is only reported once
@@ -70,6 +73,11 @@ export function generate_raw_chunk(
const nid = block_ids[name];
return nid === undefined ? AIR : default_values?.[nid] ?? nid;
};
// oak's are the plain bworld:log and bworld:leaves, the others are named after their wood
const wood_ids = (part: "log" | "leaves") =>
Object.fromEntries(
WOODS.map((wood) => [wood, id(wood === "oak" ? `bworld:${part}` : `bworld:${wood}_${part}`)]),
) as Record<Wood, number>;
generate_overworld(blocks, heights, biomes, chunk_x, chunk_z, seed, {
stone: id("bworld:stone"),
dirt: id("bworld:dirt"),
@@ -77,8 +85,8 @@ export function generate_raw_chunk(
sand: id("bworld:sand"),
snow: id("bworld:snow"),
water: id("bworld:water"),
log: id("bworld:log"),
leaves: id("bworld:leaves"),
logs: wood_ids("log"),
leaves: wood_ids("leaves"),
}, (x, y, z, block) => spills.push(x, y, z, block));
generate_ores(blocks, chunk_x, chunk_z, seed, block_ids, BASE_ORES, default_values);
@@ -87,7 +95,7 @@ export function generate_raw_chunk(
generate_features(blocks, heights, biomes, set, chunk_x, chunk_z, seed, block_ids, worldgen.features);
}
return { blocks, spills: new Int32Array(spills) };
return { blocks, spills: new Int32Array(spills), biomes };
}
// each block an ore replaces becomes the first ore whose noise is above its threshold