Add all textures and models from create
This commit is contained in:
+10
-2
@@ -6,6 +6,8 @@
|
||||
// deno run -A tools/importer.ts texture path/to/resources --output mods/example/textures
|
||||
// a folder can be a whole mod's resources (every assets/<namespace>/<kind> in it), one assets/<namespace>/<kind>, or a
|
||||
// folder inside one. each kind is in tools/importer/, see USAGE for the options
|
||||
import { import_blocks } from "./importer/blocks.ts";
|
||||
import { import_items } from "./importer/items.ts";
|
||||
import { import_models } from "./importer/models.ts";
|
||||
import { DEFAULT_REMAPS, type ImportOptions, type ImportReport } from "./importer/resources.ts";
|
||||
import { import_textures } from "./importer/textures.ts";
|
||||
@@ -13,6 +15,8 @@ import { import_textures } from "./importer/textures.ts";
|
||||
const KINDS: Record<string, (input: string, options: ImportOptions) => ImportReport> = {
|
||||
model: import_models,
|
||||
texture: import_textures,
|
||||
blockstate: import_blocks,
|
||||
item: import_items,
|
||||
};
|
||||
|
||||
const USAGE = `deno run -A tools/importer.ts <kind> <file or folder> [options]
|
||||
@@ -20,14 +24,17 @@ const USAGE = `deno run -A tools/importer.ts <kind> <file or folder> [options]
|
||||
kinds:
|
||||
model java block models to bworld models
|
||||
texture textures, with their .png.mcmeta animations
|
||||
blockstate blockstates to blocks, with their states, models and items, and placeholder mining
|
||||
item item models to items, for the items that aren't a block's
|
||||
|
||||
options:
|
||||
--output PATH the file (for one input file) or the folder to write. one model without it is printed
|
||||
--namespace NS the namespace, when the input isn't inside assets/<namespace>/, or the only one to take from a
|
||||
folder with several
|
||||
--parents FOLDER another folder to follow parent models through, like another mod's resources. can be repeated
|
||||
--remap FILE json that renames locations before they become ids, longest match first:
|
||||
{ "textures": { "minecraft:block/": "bworld:" }, "models": {} }
|
||||
--remap FILE json that renames locations before they become ids, longest match first, and leaves out
|
||||
locations that match a "skip" pattern:
|
||||
{ "textures": { "minecraft:block/": "bworld:" }, "models": {}, "skip": ["crimson"] }
|
||||
minecraft's block and item textures become bworld's of the same name unless it says otherwise`;
|
||||
|
||||
function parse_args(args: string[]) {
|
||||
@@ -48,6 +55,7 @@ function parse_args(args: string[]) {
|
||||
options.remaps = {
|
||||
textures: { ...DEFAULT_REMAPS.textures, ...remap.textures },
|
||||
models: { ...DEFAULT_REMAPS.models, ...remap.models },
|
||||
...(remap.skip ? { skip: remap.skip } : {}),
|
||||
};
|
||||
} else if (arg.startsWith("--")) throw new Error(`unknown option ${arg}`);
|
||||
else positional.push(arg);
|
||||
|
||||
Reference in New Issue
Block a user