Hand crank and shafts
This commit is contained in:
+5
-2
@@ -46,7 +46,9 @@ options:
|
||||
{ "textures": { "minecraft:block/": "bworld:" }, "models": {}, "ids": {}, "tags": {},
|
||||
"skip": ["crimson"] }
|
||||
minecraft's block and item textures, blocks, items and tags become bworld's of the same name,
|
||||
and forge's shared tags c's, unless it says otherwise`;
|
||||
and forge's shared tags c's, unless it says otherwise
|
||||
--blocks FILE json of fields blocks get by id, over the placeholders, for blockstate. what java sets in
|
||||
code, like components and mining: { "gears:shaft": { "components": {...} } }`;
|
||||
|
||||
function parse_args(args: string[]) {
|
||||
const positional: string[] = [];
|
||||
@@ -70,7 +72,8 @@ function parse_args(args: string[]) {
|
||||
tags: { ...DEFAULT_REMAPS.tags, ...remap.tags },
|
||||
...(remap.skip ? { skip: remap.skip } : {}),
|
||||
};
|
||||
} else if (arg.startsWith("--")) throw new Error(`unknown option ${arg}`);
|
||||
} else if (arg === "--blocks") options.blocks = JSON.parse(Deno.readTextFileSync(value()));
|
||||
else if (arg.startsWith("--")) throw new Error(`unknown option ${arg}`);
|
||||
else positional.push(arg);
|
||||
}
|
||||
return { positional, options };
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// java blockstates (assets/<namespace>/blockstates/*.json) to bworld's blocks/, so a mod's blocks can be placed and look
|
||||
// right: their states, and the model each state is drawn with, turned. how a block behaves isn't in any data file (java
|
||||
// mods set mining, sounds and what blocks do in code), so every block gets the same placeholders: a second to break with
|
||||
// anything, dropping itself
|
||||
// anything, dropping itself. --blocks gives some of them more, see ImportOptions.blocks
|
||||
import { dirname, join } from "@std/path";
|
||||
import { FORMAT_VERSION } from "$/common/mod_data.ts";
|
||||
import { is_empty, made_by, model_source, type ModelSource } from "./models.ts";
|
||||
@@ -95,11 +95,19 @@ export function import_blocks(input: string, options: ImportOptions = {}): Impor
|
||||
const result = convert_blockstate(location, json, read, remaps);
|
||||
if (result.kind === "error") report.errors.push({ location, problems: result.problems });
|
||||
else if (claim(result.id, location)) {
|
||||
Object.assign(result.json.block, options.blocks?.[result.id]);
|
||||
for (const warning of result.warnings) report.warnings.push({ location, warning });
|
||||
const text = format_json(result.json) + "\n";
|
||||
report.written.push({ location, id: result.id, file: join(options.output, `${where.path}.json`), text });
|
||||
}
|
||||
}
|
||||
// a typo in the table would otherwise quietly give a block nothing
|
||||
const written = new Set(report.written.map(({ id }) => id));
|
||||
for (const id of Object.keys(options.blocks ?? {})) {
|
||||
if (!written.has(id)) {
|
||||
report.errors.push({ location: id, problems: ["--blocks has it, but no block was made for it"] });
|
||||
}
|
||||
}
|
||||
write_report(report);
|
||||
return report;
|
||||
}
|
||||
|
||||
@@ -253,6 +253,9 @@ export interface ImportOptions {
|
||||
// more folders to look things up in, like parent models from another mod
|
||||
parents?: string[];
|
||||
remaps?: Remaps;
|
||||
// fields blocks get by id, over the placeholders, like their components or how long they take to mine. java sets
|
||||
// those in code, so a mod's import keeps them in a table, like mods/create/import/blocks.json
|
||||
blocks?: Record<string, Record<string, unknown>>;
|
||||
}
|
||||
|
||||
// one file an import makes: text to write, or a file to copy
|
||||
|
||||
Reference in New Issue
Block a user