Expand description
The .yui screen designer’s backend: the canvas drawn by yog-ui itself
(the crate mods render with in game) through a recording YogGfxApi,
rasterized with Minecraft’s own font and textures from the local game
files; a preview mode driving the same tree with real UI events
(click:X:Y, scroll:DY, scrollbar drags); and code-behind handlers.
Modules§
- advancements
- A tab of the game’s advancements screen, drawn as the game draws it
(
AdvancementsScreen,AdvancementTab,AdvancementWidget,TreeNodePositionof 1.20.1–1.21.1): the tree laid out by the game’s algorithm, the window, the root’s background, the connectors, the frames and icons, and a hovered advancement’s title bar and description — in the game’s font, on a screen of [SCREEN] GUI pixels. - assets
- Minecraft’s own resources, read from the user’s local game files — the client jar a Gradle dev setup (Loom, ForgeGradle, NeoGradle) or the official launcher already downloaded, plus its asset index/objects — so the designer draws with the game’s font and textures. Nothing is bundled or redistributed: when no client jar is found the designer says so and draws with what it has (flat rects, a fallback glyph box).
- blocks3d
draw2d_blocksin the designer: blocks in 3D, as the game draws them in a GUI (an orthographic view, turned and tilted), each block a cube with its model’s boxes (elements: a cable’s core, a slab’s half) with their textures — the faces you’d see, back to front, the top lit, the sides shaded like Minecraft’s. A model without elements is a cube. A block state picks its blockstate’s variant (turned by itsx/y) or every multipart part whosewhenit meets; elements keep their own rotations.- book
- The
.ybookdesigner’s backend: the book drawn by yog-book itself — the renderer the game runs — through the recordingYogGfxApi, and clicked through like a reader would (docs/books.md). - codebehind
- Event handlers in a screen’s code-behind — what double-clicking a button
in Visual Studio’s designer does:
foo.yui’son_click="play"gets anevents::PLAY => play(),arm in thematchoverclick(event)infoo.rsand an emptyfn play(), and the editor opens there. An existing arm is just navigated to. A missingfoo.rsis created with the usual skeleton (ui_include!,on_event,register). - components
- A mod’s
.yuicomponents (src/**/*.yuiwith a<Component>root — Yog-IDLE’sdocs/yui.md, “Components”), read straight from their markup: no build needed to list them in the toolbox, to edit one in the designer, or to draw an instance whose bindings only name its own properties (text="{x:Bind label}") — the instance is expanded in place, its values substituted. Components whose bindings call code ({x:Bind caption()}) are compiled: the designer host draws those with the mod’s library (custom). - content
- The block/item model editor’s backend (
.yblock/.yitem, seedocs/blocks-items.md): textures as the editor names them, the texture picker’s list, vanilla/parent models for preview, andyog import. - custom
- The mod’s
.yuicomponents in the designer. Markup-only ones are expanded in place (components); compiled ones — whose bindings call the code-behind — are drawn for real by the mod’s code: a designer host process (host) per mod loads the mod’s library built for this machine (yog designer-lib) and draws them on request. - data
- Yog Data text (the
yog-datacrate: JSON plus comments, trailing commas and unquoted keys) asserde_jsonvalues, for the readers here that only look things up. - files
- A project’s files, by format.
- font
- Minecraft’s text renderer, reproduced from its font definitions: the
font/*.jsonprovider lists (reference,space,bitmap,unihex,ttf) resolved throughResources, glyph metrics computed the way the game computes them (bitmap advance = trimmed width × scale + 1, unifont advance = width / 2 + 1, …), and§formatting codes. Text drawn through this matches the game pixel for pixel. - gfx
- A
YogGfxApitable whosedraw2d_*functions record into a display list instead of drawing — the game’s side of the ABI, played by the IDE, so yog-ui’s ownrender(the code that runs in game) produces the designer’s picture. The GPU half of the table is inert. - host
- The designer host: a child process of the IDE (
yog designer-host) that loads a mod’s library built for this machine (yog designer-lib) and draws the mod’s custom.yuicomponents through the same recordingYogGfxApithe designer uses — the mod’s own yog-ui andbuildcode, out of the IDE’s process, so a panicking/crashing/looping component (or a rebuilt library) costs a restart of the host, never the IDE. - images
<Image>in the designer: Yog image sources (item:apple,sprite:button,mod:gui/logo,mymod:gui/logo— seeyog_gfx::image) resolved against the local game files and the mod’sassets/, the way the Yog runtime resolves them in game: yog-ui’sImagewidget lays out and fits the picture, then callsdraw2d_image/image_size, which the recording table (gfx) answers from here. Also the Properties window’ssourcepicker (candidates,preview).- item_
models - Items as the game’s item models show them in a GUI, for what plain
textures don’t cover: layered models (with their tints — spawn eggs,
potions, leather) and
builtin/entityheads, drawn as a 3D head. - markup
- A
.yuitree (as the designer holds it) → theyog_ui::Widgettree the generated.g.rsbuilds in game — the same builder callsyog buildemits (yog-cliyui.rs), made directly instead of as source — wrapped like the generatedroot_with(the screen panel, anchored). - mod_ui
- A mod’s
.yuithat books and recipes use — its kinds of book page (book_page) and its recipe layouts (recipe_layout) — read with yog-book’s own reader and compiler, asyog buildreads them. - project
- A mod project as the designers see it: the manifest at its root and the mod a file is in.
- raster
- The designer’s stand-in for the game’s
DrawContext: a display list ofdraw2d_*calls (what yog-ui’s renderer — or a mod’s own render code — issues) rasterized the way the Yog hosts draw them in game: coordinates truncated to whole GUI pixels (NativeDrawcasts with(int)), alpha blending, Minecraft’s font (seefont) and textures. Output is RGBA atscalephysical pixels per GUI pixel, for the canvas to show with nearest-neighbour scaling. - recipe_
area - A
<RecipeArea kind="…">on an inventory screen, asyog buildmakes it (yog-cli’srecipe_area): the kind’s layout — its places and result real slots, numbered after the screen’s own, its pictures and stations drawn — in a canvas of the layout’s size. - recipe_
kinds - Kinds of recipe for the recipe editor — the game’s (
yog_registry’s built-in definitions) and the mod’s own (.ydefkind: "recipe_kind"), all described the same way: their slots (and the.yrecipefields the game’s are written in), their values, and — the layout books show them by (built in, or a.yuirecipe_layout) — the picture (images, the station, slot frames) with where slots, result and texts go on it. - refs
- What a content reference (
@<kind>:<id>) can name, for the designers’ pickers — the same three sourcesyog buildchecks references against: the mod’s own content (content/), the other mods’ ids it declares inyog.toml([external.<namespace>]) and the game’s (read from the client jar on this machine, when there is one). And the mod’s own.ydefs of a kind with what they say (an advancement’s parent, an effect’s color), for the designers that draw several at once. - service
- The designers as
yog servemethods: what a tool (Yog-IDLE) asks to draw, list or change, by the name it calls it and with its parameters. - tags
- What an item tag holds (
#minecraft:planks), for slots that show each of its items in turn, as JEI does: the mod’s own tags asyog buildmakes them (its.yog-build/generated/tags.json— content files’tags,.ydeftags), and the game’s — from the newest version that has the tag (one removed in 1.21 still shows its 1.20 items) — nested tags opened. Yog’s common tags (yog:ingots/iron) are the game’s and the loaders’ tags they stand for, and a loader’s (c:,forge:) holds whatyog_formats::tagssays. - worldgen
- The
.ydefdimension designer’s preview: itsterraingenerated by yog-worldgen — the code the runtime generates the game’s chunks with — and drawn from above and in a slice. - yui_
codegen .yuiscreen files (the screen designer’s format) — regenerating their code (.yog-build/generated/**/*.g.rs, what the code-behind pulls in withyog_api::ui_include!) when one is saved, throughyog ui gen— and the same for.yresresource files (resources/<Set>.g.rs, throughyog res check).
Structs§
- Assets
Info - Where the game resources came from (
None: no client jar found). - Event
Args - Event
Result - Grid
Rects - Node
Rect - A laid-out widget: its border box and its content box (inside padding), GUI px.
- Render
Args - Rendered
Functions§
- event
- mod_
root - The mod a file belongs to: the folder with its
yog.toml(else the folder holding thesrc/it’s in). - render
- reset
- Forgets a file’s preview state (scroll positions).
- this_
cli - This CLI as a command, for a design call that runs one of its
subcommands: the running binary when it’s
yog, else theyogonPATH.