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
@@ -14,7 +14,7 @@ import { DEFAULT_REMAPS, type ImportOptions, type ImportReport } from "./importe
import { import_tags } from "./importer/tags.ts";
import { import_textures } from "./importer/textures.ts";
const KINDS: Record<string, (input: string, options: ImportOptions) => ImportReport> = {
const KINDS: Record<string, (input: string, options: ImportOptions) => ImportReport | Promise<ImportReport>> = {
model: import_models,
texture: import_textures,
blockstate: import_blocks,
@@ -113,7 +113,7 @@ if (import.meta.main) {
}
const run = KINDS[kind];
if (!run) throw new Error(`"${kind}" isn't a kind that can be imported yet: ${Object.keys(KINDS).join(", ")}`);
const report = run(input, options);
const report = await run(input, options);
print_report(report);
if (report.errors.length > 0) Deno.exit(1);
} catch (e) {