Struct minecraft_assets::api::ModelIdentifier [−][src]
pub struct ModelIdentifier;
Expand description
Helper methods for dealing with model identifiers.
Why does this exist?
Prior to 1.13, model identifiers found in
assets/<namespace>/blockstates/*.json
did not include a prefix like
block/
or item/
to disambiguate between different types of models.
Because of this, the minecraft-assets
API forces the user to always
specify which type of model they are trying to reference (note the existence
of both BlockModel
and ItemModel
variants in ResourceKind
). This
way, the API will work with versions prior to 1.13.
So this struct is meant to wrap an identifier and extract its model name.
See the model_name()
documentation for more information.
Implementations
Returns the name of the model, stripping the leading path component if there is one.
Example
assert_eq!(ModelIdentifier::model_name("stone"), "stone");
assert_eq!(ModelIdentifier::model_name("block/oak_planks"), "oak_planks");
assert_eq!(ModelIdentifier::model_name("item/diamond_hoe"), "diamond_hoe");
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ModelIdentifier
impl Send for ModelIdentifier
impl Sync for ModelIdentifier
impl Unpin for ModelIdentifier
impl UnwindSafe for ModelIdentifier
Blanket Implementations
Mutably borrows from an owned value. Read more