Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

data/block_components/

A block component: typed data stored on one block cell, such as a sign’s text or a chest’s contents. It exists only while the cell holds a block its applies_to mask matches, and is removed with the block. Records are saved with their chunk and sent to the clients its audience admits. A component may name handler sections that run in the same transaction when a record is removed or added, may be sealed to one namespace’s transaction sections, and may be left out of undo, clipboard and blueprint records.

Registrymanifold:block_component
Filesdata/block_components/*.ron, *.update.ron, *.final.ron
Sidesboth: the server and every client load it, and the handshake’s data hash covers it
Readsnothing
ContractBlock components (docs/architecture/block-components.md), data stage

Entry

A record, written BlockComponent(..); the name before the parentheses is optional.

FieldTypeRequiredDefaultDescription
idstringyesThe component’s key, <mod-id>:<name>.
codecBlockComponentCodecyesHow the bytes are encoded: a serde type described by schema, or bytes the schema describes field by field.
schemalist of BlockComponentFieldnononeThe fields of the bytes, in order; for shape: Elements, one element’s.
persistu16yesThe persist version records are written at, from 1. A record saved at another version stays offline until a version that reads it.
audienceBlockAudiencenoPublicWho receives records: Public (every client holding the chunk), Owner (the record owner’s connections) or Viewers (the cell’s viewer set). Party is refused until block delivery reads party relations.
replicateBlockDeliverynoNoneWhen records reach clients.
applies_toblock-maskyesThe blocks the component may exist on.
max_bytesu32yesThe largest encoded record, 1 to 65,536 bytes.
orientation_sensitiveboolnofalseWhether rotating or mirroring the cell needs the declaring mod’s transform hook.
undoBlockUndonoIncludeWhether undo records, clipboards and blueprints capture records.
on_removeBlockHandlernoNoneThe transaction section kind appended when a record is removed (Handler("item.spill")); an unregistered kind refuses the transaction.
on_addBlockHandlernoNoneThe transaction section kind appended when a record is created.
writerBlockWriternoAnyWho may write records: Any, or only transaction sections of one namespace (Section("item")).
shapeBlockShapenoWholeWhole records, or Elements (a list of optional elements, sent as element deltas).

Example

No bundled file declares one yet.

Types

BlockComponentCodec

A block component’s codec.

VariantWrittenDescription
PostcardPostcardA serde type encoded with postcard, described by schema.
DynamicDynamicBytes the schema describes field by field.

BlockComponentField

One field of a block component’s schema.

A record: BlockComponentField(..) or (..).

FieldTypeRequiredDefaultDescription
namestringyesThe field’s name.
kindfield-kindyesThe field’s kind.

BlockAudience

Who receives a block component’s records.

VariantWrittenDescription
OwnerOwnerThe connections of the record’s owner.
PartyPartyThe owner’s party: refused for block components for now.
PublicPublicEvery client holding the chunk.
ViewersViewersThe cell’s viewer set.

BlockDelivery

When block component records reach clients.

VariantWrittenDescription
NoneNoneNever: server only.
ToAllToAllWith the chunk and on every change, to the clients the audience admits.
OnRequestOnRequestOnly to the cell’s viewer set.

BlockUndo

Whether records travel through undo, clipboards and blueprints.

VariantWrittenDescription
IncludeIncludeThey do.
ExcludeExcludeThey never do: a restored or pasted block comes back without it.

BlockHandler

A handler section kind, or none.

VariantWrittenDescription
NoneNoneNo handler.
HandlerHandler(string)The section kind to append.

BlockWriter

Who may write a block component.

VariantWrittenDescription
AnyAnyAny transaction section.
SectionSection(string)Only sections whose kind is this namespace or starts with it and a ..

BlockShape

How a block component’s bytes are structured.

VariantWrittenDescription
WholeWholeOne value.
ElementsElementsA list of optional elements.

Value forms used here: block-mask, field-kind.