Interface ModelResourceProvider
- 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 resource providers.
Model resource providers hook the loading of model *files* from the resource tree; that is, in vanilla, it handles going from "minecraft:block/stone" to a "assets/minecraft/models/block/stone.json" file.
This is where you want to add your own custom model formats.
As providers are instantiated with a new provider, it is safe (and recommended!) to cache information inside a loader.
Keep in mind that only *one* ModelResourceProvider may respond to a given model at any time. If you're writing, say, an OBJ loader, this means you could easily conflict with another OBJ loader unless you take some precautions, for example:
- Only load files with a mod-suffixed name, such as .architect.obj,
- Only load files from an explicit list of namespaces, registered elsewhere.
-
Method Summary
Modifier and TypeMethodDescriptionloadModelResource
(Identifier resourceId, ModelProviderContext context)
-
Method Details
-
loadModelResource
@Nullable @Nullable UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException - Parameters:
resourceId
- The resource identifier to be loaded.- Returns:
- The loaded UnbakedModel, or null if this ModelResourceProvider doesn't handle a specific Identifier (or if there was no error!).
- Throws:
ModelProviderException
-