Skip to main content

Crate yog_book

Crate yog_book 

Source
Expand description

yog-book — guide books for Yog mods: the format (a .ybook file, see Book) and the renderer the game and Yog-IDLE draw it with (BookRenderer, draw2d alone).

A book names what it shows — items, blocks, entities, recipes, its own entries — through typed references (@item:minecraft:stick, see refs); tools check them and hand the renderer plain ids.

Re-exports§

pub use renderer::BOOK_PNG;
pub use renderer::BOOK_SHEET;
pub use renderer::BookRenderer;
pub use renderer::CRAFTING_PNG;
pub use renderer::CRAFTING_SHEET;
pub use renderer::LANG;
pub use renderer::PageDrawer;
pub use state::BookViewState;
pub use theme::BookTheme;

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.

Enums§

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

Functions§

multiblock_blocks
The blocks of a multiblock pattern (layers top to bottom, rows of characters) with their mapping: ((x, y, z), block state).
set_unlocked
Tells the books how to know what the reader has unlocked.
shown
Whether entry shows in the book’s lists: not secret, and its advancement (if it waits for one) had.