The fallback model loader allows a block or item to select between different models based on the mods that are loaded. Unlike other Mantle models, this is just a loader, and typically will load another model format.

Fallback

The fallback model loader allows selecting between different model loaders on the basis of loaded mods. It has the following format:

  • (Object): Fallback JSON.
    • loader (Resource Location): Always mantle:fallback.
    • models (Array): List of model loaders to try.
      • (Object): A single model in the list.
        • loader (Resource Location): Loader to use for this model option. If unset, uses the vanilla block model loader.
        • fallback_mod_id (String): Mod that must be loaded to use this model option. If unset, defaults to the namespace of the loader, or unconditional if no loader is set.
        • All fields from the model loader.

Example

The following JSON produces a connected model if Tinkers’ Construct is loaded, and a vanilla model otherwise. Note that if fallback_mod_id was not specified, the dependency for the first model would be Mantle.

{
  "loader": "mantle:fallback",
  "models": [
    {
      "fallback_mod_id": "tconstruct",
      "loader": "mantle:connected",
      "parent": "block/cube_all",
      "textures": {
        "all": "block/glass"
      },
      "connection": {
        "textures": { "all": "cornerless_full" }
      }
    },
    {
      "parent": "block/cube_all",
      "textures": {
        "all": "block/glass"
      }
    }
  ]
}