Interface ModelVariantProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for model variant providers.
Model variant providers hook the resolution of ModelIdentifiers. In vanilla, this is
the part where a "minecraft:stone#normal" identifier triggers the loading of a
"minecraft:models/stone" model (ModelResourceProvider
handles the later step).
The most common use of this is to cooperate with a ModelAppender
, but it can
also allow you to add your own block- or item-state formats. To trigger the loading
of another model, use the passed ModelProviderContext
.
As every model loading is instantiated with a new provider, it is safe (and recommended!) to cache information.
Keep in mind that only *one* ModelVariantProvider may respond to a given model at any time.
-
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.client.render.model.UnbakedModel
loadModelVariant(net.minecraft.client.util.ModelIdentifier modelId, ModelProviderContext context)
-
Method Details
-
loadModelVariant
@Nullable @Nullable net.minecraft.client.render.model.UnbakedModel loadModelVariant(net.minecraft.client.util.ModelIdentifier modelId, ModelProviderContext context) throws ModelProviderException- Parameters:
modelId
- The model identifier, complete with variant.- Returns:
- The loaded UnbakedModel, or null if this ModelVariantProvider doesn't handle a specific Identifier (or if there was no error!).
- Throws:
ModelProviderException
-