Loot tables

This commit is contained in:
2026-10-08 00:54:45 -03:00
parent 757ee74bc7
commit ec2b53c02a
45 changed files with 1733 additions and 150 deletions
+6
View File
@@ -21,6 +21,7 @@ import {
TagRegistry,
} from "./mod_data.ts";
import { resolve_tags, Tags } from "./tags.ts";
import type { LootTableJson } from "./loot.ts";
import { register_block_item } from "./utils.ts";
import type { ModelJson } from "./block_models.ts";
@@ -40,6 +41,8 @@ export interface ModData {
effects: EffectJson[];
// tag files, see common/tags.ts
tags: TagJson[];
// see common/loot.ts. missing from mods packed before there were loot tables
loot_tables?: LootTableJson[];
}
// a mod as the server lists it to clients, in load order: the .bmod players download, without its server script
@@ -117,6 +120,9 @@ export function register_mod_data(mods: { id: string; data: ModData }[]): Recipe
for (const json of data.effects) {
EverythingRegistry.register<EffectJson>("effects", json.id, json);
}
for (const json of data.loot_tables ?? []) {
EverythingRegistry.register<LootTableJson>("loot_tables", json.id, json);
}
} catch (e) {
throw new ModLoadError(id, (e as Error).message);
}