Biome as data
This commit is contained in:
@@ -21,6 +21,7 @@ import { check_references, load_order, type LoadedMod, type ModReport } from "$/
|
||||
import { png_size, texture_size_problem } from "$/common/bmod.ts";
|
||||
import { type TextureJson, validate_texture_json } from "$/common/texture_animation.ts";
|
||||
import { type LootTableJson, validate_loot_table } from "$/common/loot.ts";
|
||||
import { validate_biome } from "$/common/worldgen/biomes.ts";
|
||||
import { dirname } from "@std/path";
|
||||
|
||||
export { load_order, type LoadedMod, type ModReport };
|
||||
@@ -82,6 +83,7 @@ function load_mod(mods_dir: string, id: string): LoadedMod {
|
||||
effects: [],
|
||||
tags: [],
|
||||
loot_tables: [],
|
||||
biomes: [],
|
||||
textures: [],
|
||||
texture_files: new Map(),
|
||||
texture_json: new Map(),
|
||||
@@ -147,6 +149,7 @@ function load_mod(mods_dir: string, id: string): LoadedMod {
|
||||
load_data("recipes", "recipe", validate_recipe, mod.recipes);
|
||||
load_data("entities", "entity", validate_entity, mod.entities);
|
||||
load_data("effects", "effect", validate_effect, mod.effects);
|
||||
load_data("worldgen/biomes", "biome", validate_biome, mod.biomes);
|
||||
|
||||
for (const file of walk(`${dir}/models`, ".geo.json")) {
|
||||
const path = `models/${file}`;
|
||||
|
||||
@@ -43,6 +43,7 @@ export async function pack_mod(mod: LoadedMod): Promise<Uint8Array<ArrayBuffer>>
|
||||
effects: mod.effects.map((e) => e.json),
|
||||
tags: mod.tags.map((t) => t.json),
|
||||
loot_tables: mod.loot_tables.map((t) => t.json),
|
||||
biomes: mod.biomes.map((b) => b.json),
|
||||
},
|
||||
scripts,
|
||||
textures,
|
||||
|
||||
@@ -7,11 +7,18 @@ import { CHUNK_AREA, CHUNK_HEIGHT, CHUNK_SIZE, SEA_LEVEL } from "$/common/consta
|
||||
import { generate_raw_chunk } from "$/common/generation.ts";
|
||||
import { OverworldTerrain } from "$/common/worldgen/terrain.ts";
|
||||
import { pick_biome } from "$/common/worldgen/overworld.ts";
|
||||
import { register_biome } from "$/common/worldgen/biomes.ts";
|
||||
import { load_and_check } from "./check_mods.ts";
|
||||
|
||||
const seed = Deno.args[0] ?? "preview";
|
||||
const out = Deno.args[1] ?? ".";
|
||||
const [center_x, center_z] = [Number(Deno.args[2] ?? 0), Number(Deno.args[3] ?? 0)];
|
||||
|
||||
// the base game's biomes, from mods/bworld
|
||||
for (const mod of load_and_check()) {
|
||||
if (mod.id === "bworld") { for (const { json } of mod.biomes) register_biome(json); }
|
||||
}
|
||||
|
||||
const NAMES = [
|
||||
"bworld:stone",
|
||||
"bworld:dirt",
|
||||
|
||||
Reference in New Issue
Block a user