Skip to main content

Module book

Module book 

Source
Expand description

Guide books: the .ybook format and its renderer.

Modules§

layout
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:
markup
Book texts are Yog text (yog_ui::rich: {b|…}, {#rrggbb|…}, …) with two words of the book’s own, turned into Yog text’s when the book is prepared:
page_type
A mod’s own kinds of page (hexcasting:pattern): a .yui component with book_page="…" declares one — its properties are the page’s fields, its body what the page shows — and yog build hands it to the book as a PageType. A page of the kind (CustomPage) is laid out by the book like the built-in ones; what only code can draw is a drawn element (crate::BookPage::Drawn’s primitive).
refs
References in a book: what a .ybook names — items, blocks, entities, recipes, its own entries and categories — it names through a typed reference, @item:minecraft:stick, never a bare game id. The schema (crate::Book’s #[derive(Schema)]) says which field takes what; tools check every reference through a Resolve (yog build: does it exist on every Minecraft version the mod targets?) and get the id the game uses.
renderer
Book renderer: yog-ui lays the book out and draws its text and buttons; everything else goes through draw2d too — the sprite sheets, item icons, SVG pages, entities — so the game and Yog-IDLE’s book designer run the same code.
state
Per-book navigation state.
theme
Visual theme for book rendering.
ui
The .yui XML subset — what yog build and Yog-IDLE read screens, book pages and recipe layouts from: elements with attributes in source order and their lines, for messages.

Structs§

Book
A guide book: what a .ybook file holds.
BookCategory
A category of the book’s home page.
BookEntry
One entry: its pages, in a category.
BookRenderer
BookTheme
All colors are 0xAARRGGBB.
BookViewState

Enums§

BookPage
One page of an entry: {"type": "spotlight", "item": "@item:minecraft:stick", …}.

Constants§

BOOK_SHEET
The image source the book draws BOOK_PNG as: the loader ships it as assets/yog/textures/gui/book/book.png (Yog-IDLE resolves it to the bytes).
CRAFTING_SHEET
The image source the book draws CRAFTING_PNG as.

Statics§

BOOK_PNG
The book’s sprite sheet (cover, pages, separators, nameplate).
CRAFTING_PNG
The crafting-grid sprite sheet.
LANG
The book’s own words (yog.book.*) per language, as the loader’s jars ship them in assets/yog/lang/ (for hosts without them, like Yog-IDLE).

Functions§

multiblock_blocks
The blocks of a multiblock pattern (layers top to bottom, rows of characters) with their mapping: ((x, y, z), block state).

Type Aliases§

PageDrawer
Draws a mod’s picture (BookPage::Drawn): (ctx, drawer, data, [x, y, w, h]).