Skip to main content

BlockEntitiesRegistrar

Trait BlockEntitiesRegistrar 

pub trait BlockEntitiesRegistrar {
    // Required methods
    fn block_entity_type_key(&mut self, id: &str) -> BlockEntityTypeKey;
    fn declare_block_entity_type(
        &mut self,
        path: &str,
        blocks: Vec<String>,
    ) -> BlockEntityTypeKey;
    fn attach_block_entity_part(
        &mut self,
        key: &BlockEntityTypeKey,
        kind: &'static str,
        part: Arc<dyn BlockEntityPart>,
    ) -> Result<(), BlockEntityPartError>;
    fn provide_block_entity_capability(
        &mut self,
        name: &'static str,
        kind: &BlockEntityTypeKey,
        before_game: bool,
        provider: BlockProviderOf,
    );
}
Expand description

Registrar operations for block entities.

Required Methods§

fn block_entity_type_key(&mut self, id: &str) -> BlockEntityTypeKey

Look up a vanilla or another mod’s type. The final registry validates it at load.

fn declare_block_entity_type( &mut self, path: &str, blocks: Vec<String>, ) -> BlockEntityTypeKey

Declare block entity type path in a namespace owned by this mod’s manifest, held by blocks; mods usually reach it through block_entity_type.

fn attach_block_entity_part( &mut self, key: &BlockEntityTypeKey, kind: &'static str, part: Arc<dyn BlockEntityPart>, ) -> Result<(), BlockEntityPartError>

Attach part, of kind kind, to the mod block entity type key.

fn provide_block_entity_capability( &mut self, name: &'static str, kind: &BlockEntityTypeKey, before_game: bool, provider: BlockProviderOf, )

Answer block entity capability name for type kind with provider, asked ahead of the game’s own when before_game; mods reach it through block_entity_capability.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§