Skip to main content

Module layout

Module layout 

Source
Expand description

Recipe layouts: how a kind of recipe is shown — in books and in Yog-IDLE’s recipe editor. The game’s kinds have built-in layouts (Patchouli’s: the crafting grid, the furnace strip, the smithing strip, …); a mod lays out its own kinds, or the game’s, with a .yui component — drawn and arranged in the screen designer like any UI:

<Component name="InfusionLayout" recipe_layout="infusion" width="96" height="44">
    <Image source="mymod:gui/infusion" uv="0 0 96 44"/>
    <RecipeSlot slot="ring" x="4" y="4" frame="true"/>
    <RecipeSlot slot="ring" x="4" y="24" frame="true"/>
    <RecipeSlot slot="core" x="40" y="14" frame="true"/>
    <ItemSlot item="minecraft:beacon" x="40" y="0"/>
    <RecipeResult x="76" y="14"/>
    <RecipeCount x="78" y="32"/>
    <Label text="{x:Bind time} ticks" x="40" y="34"/>
</Component>

recipe_layout names the kinds it shows (several: space-separated): the mod’s own (infusion, its namespace added) or the game’s (shaped, smelting, …). Positions are GUI pixels from the layout’s top-left; an item is 16×16. A slot’s places take its ingredients in order (index to say which). The game’s kinds name their slots: grid (crafting, 9 places; a shaped recipe’s cells by position), input (cooking, stonecutting), template/base/addition (smithing). A label’s bindings are the recipe’s values (time, experience, or a mod kind’s values).

Structs§

RecipeLayout
How one or more kinds of recipe are shown.

Enums§

LayoutPart
One part of a RecipeLayout.

Constants§

FRAME_UV
A slot frame on SHEET, 24×24, the item inside at +4,+4.
SHEET
The image the built-in layouts are drawn from (Patchouli’s crafting sheet).

Statics§

BUILT_IN
The game’s kinds’ layouts.

Functions§

compile
root (a <Component recipe_layout="…">) as a layout; ns: the mod’s namespace, for its own kinds written without one.
find
The layout for recipes of kind: one of own (a book’s), else built in.
game_kinds
The game’s kinds of recipe (those with built-in layouts).
is_recipe_layout
Whether root is a recipe layout (<Component recipe_layout="…">).