Expand description
Block entity system for blocks that need additional data storage.
Block entities provide additional data storage and functionality for blocks that need more than what block state properties can offer (e.g., chests, furnaces, signs, etc.).
ยงArchitecture
Similar to the block/item behavior system, block entities use a registry pattern:
BlockEntityRegistry- mapsBlockEntityTypeto factory functionsBlockEntityStorage- stores block entities in a chunk
ยงUsage
โ
use steel_core::block_entity::{init_block_entities, BLOCK_ENTITIES};
// After registry is frozen, call once at startup:
init_block_entities();
// Create a block entity:
let entity = BLOCK_ENTITIES.create(block_entity_type, pos, state);Modulesยง
- block_
state_ ๐nbt - Vanilla block-state NBT codec shape used by block entities.
- entities
- Block entity implementations.
- registry ๐
- Block entity registry for creating block entity instances.
- storage ๐
- Block entity storage for chunks.
Structsยง
- Block
Entity Base - Immutable block-entity identity and its short-lived lifecycle state.
- Block
Entity ๐Lifecycle - Block
Entity ๐Lifecycle Dispatch Guard - Block
Entity Registry - Registry for block entity factories.
- Block
Entity Ticker - Erased block-state-selected ticker for one concrete block-entity type.
Enumsยง
Staticsยง
- BLOCK_
ENTITIES - Global block entity registry.
Traitsยง
- Block
Entity - Trait for all block entities.
- Block
Entity Lifecycle Ext - Final block-entity common-state operations.
Functionsยง
- init_
block_ entities - Initializes the global block entity registry.
Type Aliasesยง
- Block
Entity Factory - Factory function type for creating block entities.
- Shared
Block Entity - A stable shared block entity without a whole-object mutex.