Expand description
Inventory framework — real Container/Menu screens (BlockEntity-backed),
as opposed to ui’s HUD-drawn overlays. See yog-inventory’s DESIGN.md.
Structs§
- Inventory
Def - Describes one inventory-backed screen: how many slots a mod block has, where they sit, whether the player’s own inventory is appended below, and which background texture to draw (vanilla default, or a mod’s own).
- Machine
- A machine in an inventory: it makes recipes of
kindfrom what’s in itsplaces— each a slot of the inventory holding one ingredient of one of the kind’s slots — into itsresultslot. - Machine
Place - One ingredient’s place: the
index-th of the kind’s slotslot, in the inventory’s slotinv. - Slot
Layout - Pixel position of a single slot in vanilla GUI coordinate space (the same space vanilla screens use: origin at the panel’s top-left corner, one vanilla slot = 18×18px).
- Slot
View - One inventory slot’s content, as of the last snapshot.
- YogInv
Slot Raw - One inventory slot’s raw wire data for
YogInvSnapshotRaw. - YogInv
Snapshot Raw - Raw per-frame snapshot of the currently-open inventory screen, built and owned by the runtime, valid only for the duration of the render call that hands it over.
Constants§
- DEFAULT_
PLAYER_ INV_ OFFSET - Default position of the player’s main inventory (3×9) relative to the panel’s top-left corner — matches vanilla furnace/chest-style screens.
- MAX_
SNAPSHOT_ SLOTS - Capacity of
YogInvSnapshotRaw::slots— covers the largest realistic inventory screen (a mod’s own slots + player main inventory + hotbar). - PLAYER_
INV_ TO_ HOTBAR_ GAP - Extra vertical gap between the player’s main inventory and their hotbar,
on top of the normal per-row
SLOT_SIZEspacing (also a vanilla convention). - SLOT_
SIZE - Vanilla spacing between adjacent slots in the default grid.
Functions§
- current_
slot - Slot
index’s content right now, orNoneif out of range. - current_
slot_ count - Number of slots in the currently-open inventory screen (0 if none is open).
- decode_
layout - Inverse of
encode_layout. Malformed entries are skipped. - encode_
layout - Encode an
InventoryDef’s slot layout as"x:y,x:y:a|b,..."— the wire format used when handing the layout to the Java host (mirrors howBlockDef::connect_groupsis comma-joined for its ABI struct); a slot that takes only some items adds them after a third:,|-joined.