Biome as data

This commit is contained in:
2026-10-08 13:34:32 -03:00
parent 9f0b049148
commit 7e7ac8f6f4
49 changed files with 913 additions and 224 deletions
+6
View File
@@ -22,6 +22,7 @@ import {
} from "./mod_data.ts";
import { resolve_tags, Tags } from "./tags.ts";
import type { LootTableJson } from "./loot.ts";
import { type BiomeJson, register_biome } from "./worldgen/biomes.ts";
import { register_block_item } from "./utils.ts";
import type { ModelJson } from "./block_models.ts";
@@ -43,6 +44,8 @@ export interface ModData {
tags: TagJson[];
// see common/loot.ts. missing from mods packed before there were loot tables
loot_tables?: LootTableJson[];
// see common/worldgen/biomes.ts. missing from mods packed before biomes were data
biomes?: BiomeJson[];
}
// a mod as the server lists it to clients, in load order: the .bmod players download, without its server script
@@ -123,6 +126,9 @@ export function register_mod_data(mods: { id: string; data: ModData }[]): Recipe
for (const json of data.loot_tables ?? []) {
EverythingRegistry.register<LootTableJson>("loot_tables", json.id, json);
}
for (const json of data.biomes ?? []) {
register_biome(json);
}
} catch (e) {
throw new ModLoadError(id, (e as Error).message);
}