Expand description
Yog API — the single crate mod authors depend on.
A facade that re-exports every Yog domain plus the central Registry hub.
Add a new domain crate, re-export it here, and mods pick it up via
yog_api::*. Items are available both flat (yog_api::Registry) and
namespaced by domain (yog_api::world::World).
Modules§
- book
- In-game book/documentation system (Patchouli-like).
- command
- Commands.
- config
- Mod configuration (typed key/value files).
- content
- Content registration (custom items / blocks / food).
- core
- Core types and handles.
- entity
- Entity access (teleport, position, health, … by UUID).
- event
- Events and the subscription registry.
- gfx_
core - Core graphics constants and enumerations.
- gfx_
draw2d - 2D drawing helpers — thin wrappers over the
draw2d_*ABI functions. - gfx_gl
- Low-level GPU resource wrappers:
Buffer,VertexArray,ShaderProgram,Texture. - network
- Networking (raw-byte packets over channels).
- player
- Player access (give item, teleport).
- storage
- Persistent key-value storage for mod data.
- ui
- UI framework — flexbox layout + widgets on top of yog-gfx.
- widget
- Widget types and styling.
- world
- World access (block get/set, dimensions).
Macros§
- error
- Logging macros (
yog_api::info!,warn!,error!). Log at ERROR level. - export_
mod - Export a
Modas a dynamically loadable Yog mod. - info
- Logging macros (
yog_api::info!,warn!,error!). Log at INFO level. - packet
- Declare a typed packet struct whose fields are automatically encoded/decoded.
- warn
- Logging macros (
yog_api::info!,warn!,error!). Log at WARN level.
Structs§
- Advancement
Event - Fired when a player earns an advancement (Post only).
- Advancement
Reward - Attack
Entity Event - Fired when a player attacks (left-clicks) an entity (server side).
- Block
Break Event - Fired when a player breaks a block (server side).
- Block
Def - A custom block to register; it also gets a matching block-item.
- Block
Pos - A block position in the world.
- Book
- The top-level book definition — replaces
patchouli_books/<id>/book.json. - Book
Category - Represents a book category tab (e.g. “Basics”, “Patterns”).
- Book
Entry - One entry in a book (like a “page” in the TOC sidebar).
- Book
Macro - A macro substitution (e.g.
$(thing)→ red color span). - Book
Recipe - A shapeless recipe that produces a book from
yog-book. Replacespatchouli:shapeless_book_recipe. - Book
Registry - Global registry for all in-game books.
- CServer
- A handle to the runtime’s server actions, backed by
YogServerfn pointers. Given to every handler as&dyn Server. - Chat
Event - Fired when a player sends a chat message.
- Client
Tick Event - Fired every client tick on the render thread.
- Command
Context - Details of a command invocation.
- Config
- A key/value configuration file backed by
<game_dir>/yog-config/<mod_id>.cfg. - Container
Close Event - Fired when a player closes a container screen (Post only).
- Container
Open Event - Fired when a player opens a container screen.
- Craft
Event - Fired when a player takes a crafted item from a crafting output slot (Post only).
- Entity
- A handle to one entity by UUID, bound to a
Server. - Entity
Damage Event - Fired after a living entity takes damage (server side).
- Entity
Death Event - Fired after a living entity dies (server side).
- Entity
Interact Event - Fired when a player right-clicks (interacts with) an entity (server side).
- Entity
Spawn Event - Fired when any entity is loaded into a world (server side).
- Explosion
Event - Fired when an explosion occurs in a world.
- FoodDef
- Nutritional properties for a food item.
- Furnace
Recipe - A furnace smelting recipe.
- GfxContext
- Handle to the GPU and draw capabilities for a single render frame.
- ItemDef
- A custom item to register, identified by
namespace:path. - Item
Modifier - An item modifier applied during loot generation (like smelting, enchanted, etc.).
- Item
Pickup Event - Fired when a player picks up an item entity.
- KeyPress
Event - Fired on every key press, release, or repeat (client-side).
- Packet
Event - A packet received on a channel.
- Place
Block Event - Fired when a player places a block (server side).
- Player
- A handle to one player, bound to a
Server. - Player
Death Event - Fired when a player dies.
- Player
Join Event - Fired when a player joins the server.
- Player
Leave Event - Fired when a player leaves the server.
- Player
Move Event - Fired every time a player sends a movement packet (very high frequency).
- Player
Respawn Event - Fired when a player respawns after death (Post only).
- Projectile
HitEvent - Fired when a persistent projectile (arrow, trident, etc.) hits a target.
- Registry
- Wraps the
YogApitable and provides an ergonomic registration API. - Screen
Event - Fired when a GUI screen opens or closes.
- Shaped
Recipe - A shaped crafting recipe (3×3 grid with a pattern and key mapping).
- Shapeless
Recipe - A shapeless crafting recipe (unordered ingredients).
- Startup
Grant - Grant items/books to every player once when they first join.
This is the Yog-side replacement for
grant_patchi_book.json. - Storage
- Typed, scoped persistent key-value store.
- UiRoot
- Top-level UI tree. Build it, call
layout, then [render] each frame. - UseBlock
Event - Fired when a player right-clicks a block (server side).
- UseItem
Event - Fired when a player right-clicks with an item (server side).
- World
- An ergonomic handle to one dimension’s blocks, bound to a
Server. - YogApi
- Stable C ABI — re-exported so mods don’t need a direct
yog-abidependency. Passed toyog_mod_register. Call the function pointers here to register handlers, commands, content, and schedulers.
Enums§
- Align
- Cross-axis alignment.
- Book
Page - A single page variant inside a book entry.
- Event
Phase - Whether a handler is running before or after the action.
- FlexDir
- Layout direction for flex containers.
- Storage
Scope - Determines which backing file a
Storageuses. - Value
- A typed storage value.
Constants§
- ABI_
VERSION - Stable C ABI — re-exported so mods don’t need a direct
yog-abidependency.ABI_MAJOR * 10_000 + ABI_MINOR. Checked at mod load time.
Traits§
- Mod
- Implemented by every Yog mod. Called once at startup to register handlers.
- Packet
- A typed packet that can be encoded to / decoded from a raw byte buffer.
- Packet
Field - Encode/decode a single field to/from a byte buffer.
- Server
- Low-level capabilities the Yog runtime exposes to mods (the engine contract).