java.lang.Object
net.fabricmc.fabric.api.client.model.loading.v1.ModelModifier

public final class ModelModifier extends Object
Contains interfaces for the events that can be used to modify models at different points in the loading and baking process.

Example use cases:

  • Overriding a model for a particular block state - check if the given top-level identifier is not null, and then check if it has the appropriate variant for that block state. If so, return your desired model, otherwise return the given model.
  • Wrapping a model to override certain behaviors - simply return a new model instance and delegate calls to the original model as needed.

Phases are used to ensure that modifications occur in a reasonable order, e.g. wrapping occurs after overrides, and separate phases are provided for mods that wrap their own models and mods that need to wrap models of other mods or wrap models arbitrarily.

These callbacks are invoked for every single model that is loaded or baked, so implementations should be as efficient as possible.

  • Field Details

    • OVERRIDE_PHASE

      public static final Identifier OVERRIDE_PHASE
      Recommended phase to use when overriding models, e.g. replacing a model with another model.
    • DEFAULT_PHASE

      public static final Identifier DEFAULT_PHASE
      Recommended phase to use for transformations that need to happen before wrapping, but after model overrides.
    • WRAP_PHASE

      public static final Identifier WRAP_PHASE
      Recommended phase to use when wrapping models.
    • WRAP_LAST_PHASE

      public static final Identifier WRAP_LAST_PHASE
      Recommended phase to use when wrapping models with transformations that want to happen last, e.g. for connected textures or other similar visual effects that should be the final processing step.