Expand description
.yblock / .yitem content files — a mod’s blocks and items: their
properties, 3D model, block states and item form, in one JSON file each,
edited in Yog-IDLE’s 3D model editor — and .yrecipe files, one recipe
each (crafting, shapeless, smelting), edited in its recipe editor. See
Yog-IDLE’s docs/blocks-items.md for the formats.
yog build reads content/**/*.yblock and content/**/*.yitem and
- writes Minecraft’s JSON for them: block models, blockstates, item
models, 1.21.4+ item definitions (
assets/<ns>/items/), block loot tables, themineable/<tool>andneeds_<level>_toolblock tags; - puts their names and tooltips into the lang files (a
@<Set>.<name>text of a.yresfile under the key Minecraft looks up, a literal intoen_us); - builds the mod’s textures (
.ytexture, seetextures); - generates
.yog-build/generated/yog-content.g.rs—Blocks/Itemswith an id constant and aBlockDef/ItemDefbuilder per entry and aregisterfunction — pulled in byyog_api::content!();, which also registers them (unless an entry says"register": "manual") and every recipe.
Structs§
- Compiled
- Everything
yog buildmakes of a mod’s content files. - Imported
- What an import wrote, and what to warn of.
- Output
Set - Outputs in order, keyed by path:
OutputSet::putreplaces a path’s output (moving it to the end) without rescanning the list. - Source
- The content’s code: the root file (
GENERATED_FILE), which only includes the parts, and the parts — (name, code) each.
Constants§
- CONTENT_
DIR - Where content files live, under the mod root.
- GENERATED_
FILE - The generated Rust code, under the mod root.
- GENERATED_
PARTS_ DIR - Where the content’s code goes besides the root file, under
.yog-build/generated/: one file a part (items.g.rs,register.g.rs, …). - TAGS_
FILE - Where the mod’s tags are listed for tools (
ns:path→ its entries, by kind), as binary Yog Data — the IDE shows a tag’s items from here, as the build makes them. - TEMPLATES
Functions§
- compile
- Compiles the mod’s content files (see the module docs). Any error fails the whole thing, listing every problem.
- find
- Every content file (
CONTENT) undercontent/of the mod atroot, sorted. - import_
command yog import ...(args afterimport); an error when nothing was written.- merge_
outputs - Adds the content’s outputs to
outputs(the.yresones, say): lang entries and tags merged into what’s there (or into the mod’s own files), the rest appended. - num_
value - A number in the game’s JSON: integral values without a fraction (
16, not16.0). - read_
tags TAGS_FILEof the mod atroot, as the build last wrote it; empty without one.- valid_
id ns:path(orpath, the game’s) as the game takes it.- valid_
namespace - A namespace as the game takes it:
[a-z0-9_.-]+. - valid_
path - A resource path as the game takes it:
[a-z0-9_./-]+, not starting or ending with a/. - write_
source - Writes
compiled.sourcetoGENERATED_FILE(only when it changed); deletes it when the mod has no content files.