Skip to main content

EntitiesRegistrar

Trait EntitiesRegistrar 

pub trait EntitiesRegistrar {
    // Required methods
    fn attach_entity_part(
        &mut self,
        entity: &str,
        kind: &'static str,
        part: Arc<dyn EntityPart>,
    );
    fn provide_entity_capability(
        &mut self,
        name: &'static str,
        kind: &str,
        before_game: bool,
        provider: EntityProviderOf,
    );
}
Expand description

Registrar operations for entities.

Required Methods§

fn attach_entity_part( &mut self, entity: &str, kind: &'static str, part: Arc<dyn EntityPart>, )

Attach part, of kind kind, to the entity type entity (minecraft:zombie, mymod:golem): its register_goals runs at every Mob construction of that type (#1077).

Not on wasm: the goal surface a part’s register_goals hands the game does not cross yet (#1077); entity parts are a native mod’s for now. The gate keeps a wasm mod’s call a compile error, not a runtime one; the generator still keeps the method off the wasm world by this doc.

fn provide_entity_capability( &mut self, name: &'static str, kind: &str, before_game: bool, provider: EntityProviderOf, )

Answer entity capability name for entity type kind with provider; mods reach it through entity_capability.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§