Trait ItemsRegistrar
pub trait ItemsRegistrar {
// Required methods
fn item_key(&mut self, id: &str) -> ItemKey;
fn attach_item_part(
&mut self,
item: ItemKey,
kind: &'static str,
part: Arc<dyn ItemPart>,
);
fn attach_item_part_tag(
&mut self,
tag: &str,
kind: &'static str,
part: Arc<dyn ItemPart>,
);
fn provide_item_capability(
&mut self,
name: &'static str,
item: &str,
before_game: bool,
provider: ItemProviderOf,
);
fn place_provider(
&mut self,
name: &'static str,
provider: Arc<dyn PlaceProvider>,
);
fn register_tooltip_appender(
&mut self,
component: &str,
placement: TooltipPlacement,
appender: Arc<dyn TooltipAppender>,
);
}Expand description
Registrar operations for items.
Required Methods§
fn item_key(&mut self, id: &str) -> ItemKey
fn item_key(&mut self, id: &str) -> ItemKey
Request an item by registry id, validated after all declarations.
fn attach_item_part(
&mut self,
item: ItemKey,
kind: &'static str,
part: Arc<dyn ItemPart>,
)
fn attach_item_part( &mut self, item: ItemKey, kind: &'static str, part: Arc<dyn ItemPart>, )
Attach part, of kind kind, to item item.
fn attach_item_part_tag(
&mut self,
tag: &str,
kind: &'static str,
part: Arc<dyn ItemPart>,
)
fn attach_item_part_tag( &mut self, tag: &str, kind: &'static str, part: Arc<dyn ItemPart>, )
Attach part, of kind kind, to every item in tag tag.
fn provide_item_capability(
&mut self,
name: &'static str,
item: &str,
before_game: bool,
provider: ItemProviderOf,
)
fn provide_item_capability( &mut self, name: &'static str, item: &str, before_game: bool, provider: ItemProviderOf, )
Answer item capability name for item item with provider; mods reach it through
item_capability.
fn place_provider(
&mut self,
name: &'static str,
provider: Arc<dyn PlaceProvider>,
)
fn place_provider( &mut self, name: &'static str, provider: Arc<dyn PlaceProvider>, )
Read and write the item places ItemPlace::Mod { provider: name, .. } with provider,
as an accessory mod exposes its slots. One provider a name.
fn register_tooltip_appender(
&mut self,
component: &str,
placement: TooltipPlacement,
appender: Arc<dyn TooltipAppender>,
)
fn register_tooltip_appender( &mut self, component: &str, placement: TooltipPlacement, appender: Arc<dyn TooltipAppender>, )
Register appender as the lines data component component (mymod:charge) adds to a
stack’s tooltip, where placement puts them (NeoForge’s RegisterTooltipAppendersEvent).
Only this mod’s appender is asked, for a stack that carries the component and whose
tooltip shows it, and only while the mod is enabled. A component id that isn’t namespaced,
or a Before/After anchor the game doesn’t list as a component detail, refuses the mods
at startup, naming the mod.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".