Block registry api

This commit is contained in:
2026-11-12 20:41:13 -03:00
parent e7fe663746
commit 76802ed430
39 changed files with 499 additions and 100 deletions
+2 -2
View File
@@ -221,10 +221,10 @@ export interface Known {
tags: Record<TagRegistry, Set<string>>;
}
export function known_in(output: string): Known | undefined {
export async function known_in(output: string): Promise<Known | undefined> {
const mod = mod_of(`${output}/x`);
if (!mod) return undefined;
const mods = load_and_check(dirname(mod.dir));
const mods = await load_and_check(dirname(mod.dir));
const tags: Known["tags"] = { blocks: new Set(), items: new Set(), entities: new Set(), biomes: new Set() };
for (const { json } of mods.flatMap((mod) => mod.tags)) tags[json.registry].add(json.id);
return { ids: registered_ids(mods), tags };