Class ModelStateHelper

java.lang.Object
net.fabricmc.fabric.api.client.renderer.v1.model.ModelStateHelper

public final class ModelStateHelper extends Object
Utilities to make it easier to work with ModelState.
  • Method Summary

    Modifier and Type
    Method
    Description
    asQuadTransform(net.minecraft.client.renderer.block.dispatch.ModelState state, SpriteFinderGetter spriteFinderGetter)
    Creates a new QuadTransform that applies the given transformation.
    static net.minecraft.client.renderer.block.dispatch.ModelState
    multiply(net.minecraft.client.renderer.block.dispatch.ModelState left, net.minecraft.client.renderer.block.dispatch.ModelState right)
    Creates a new ModelState that is the product of the two given states.
    static net.minecraft.client.renderer.block.dispatch.ModelState
    of(com.mojang.math.Transformation transformation, boolean uvLock)
    Creates a new ModelState using the given transformation and enables UV lock if specified.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static net.minecraft.client.renderer.block.dispatch.ModelState of(com.mojang.math.Transformation transformation, boolean uvLock)
      Creates a new ModelState using the given transformation and enables UV lock if specified. Works exactly like BlockModelRotation, but allows an arbitrary transformation. Instances should be retained and reused, especially if UV lock is enabled, to avoid redoing costly computations.
    • multiply

      public static net.minecraft.client.renderer.block.dispatch.ModelState multiply(net.minecraft.client.renderer.block.dispatch.ModelState left, net.minecraft.client.renderer.block.dispatch.ModelState right)
      Creates a new ModelState that is the product of the two given states. States are represented by matrices, so this method follows the rules of matrix multiplication, namely that applying the resulting state is (mostly) equivalent to applying the right state and then the left state. The only exception during standard application is cull face transformation, as the result must be clamped. Thus, applying a single premultiplied transformation generally yields better results than multiple applications.
    • asQuadTransform

      public static QuadTransform asQuadTransform(net.minecraft.client.renderer.block.dispatch.ModelState state, SpriteFinderGetter spriteFinderGetter)
      Creates a new QuadTransform that applies the given transformation. The sprite finder is used to look up the current sprite to correctly apply UV lock, if present in the transformation.

      This method is most useful when creating custom implementations of UnbakedGeometry, which receive a ModelState.