Block entities
Status: Planned, with data access (API 1.11). Reading and merging the data of any block entity (SNBT, like
/data) and the slots of block containers work now:cl_level_block_entity_type/_get/_mergeandcl_level_container_*(World access). Block entity types for mod blocks (per-position data, tickers, saving and syncing) are Planned; the names below may differ.
What this will cover
A block entity holds per-position data and logic beyond what a block state can store: inventories, progress counters, custom names. This page will document registering a block entity type for a mod block, its ticker, saving and loading its data, and syncing it to clients.
What you can do today
- A mod block’s
random_tickanduse_without_itembehaviours run per position (Blocks and block states). - Container menus give a block a chest-like GUI whose contents your mod keeps (Inventories and menus).
- Per-position data can live in your mod’s own storage: the config API, or a file in
mods/<id>/data/(C/C++ through WASI), keyed by position.