Skip to main content

Module mirror

Module mirror 

Source
Expand description

Mirrors (docs/design/bus.md, “Mirrors”): data read every tick kept in shared memory. A mod declares the fields it reads (Declared: read in place, released on drop) or provides a mirror (Registry::provide_mirror: its writer is called when fields are due, with only those). Usually through #[yog_mirror], which generates both sides typed.

Modules§

host_tables
The host’s mirrors: what the game itself writes (every entity, every player), described once here — the runtime makes the Java host their provider, Java’s constants are generated from these tables, and yog_api’s typed structs are checked against them when they compile.

Structs§

BlockScope
The blocks of a box (both corners in): the host’s block mirror’s scope. Its dimension is its key space’s (yog:keys/block/<dimension>).
BlockTraits
A set of block traits.
Blocks
The blocks of the areas asked for, a dimension each: declared with Blocks::declare_in(dimension, Some(&BlockScope { min, max }), …).
ClientBlocks
The blocks of the area asked for in this client’s world, by packed position (ClientBlocks::declare_scoped(&BlockScope { min, max }, …)): each one’s state and what a body meets there.
ClientEntities
The entities this client sees, by network id: written after its ticks, on any server.
Declared
Fields of a mirror asked for: written at the rate asked while this lives, read in place; dropped, what only it asked for stops.
Entities
Every live entity, by network id.
FieldSpec
A mirror field.
MirrorSpec
A mirror: yog:mirror/<mod>/<name>, rows of one key space.
MirrorWriter
A typed provider’s turn.
Mirrored
A typed declaration: its rows read in place; dropped, released.
Players
Every player (part of the entities: their facts read through it).
Row
A row being read (what a generated view wraps).
RowWriter
A row being written (what a generated writer wraps).
Writer
A provider’s turn: the fields due, written for the rows it fills.

Enums§

Clock
Whose ticks a mirror is written after: the server’s (the world as it is), or a client’s (the world as that player sees it — what a client mod reads on any server).
Kind
The number a cell is made of.
Rate
How often a declaration wants its fields written.

Traits§

Cell
A column’s row: COUNT numbers of one Kind.
Mirror
A mirror’s row type (#[yog_mirror] implements it).