ModelResourceProvider

public interface ModelResourceProvider

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.

Functions

loadModelResource
Link copied to clipboard
@Nullable()
abstract UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context)
The resource identifier to be loaded.

Sources

jvm source
Link copied to clipboard