Class MatrixStack

java.lang.Object
net.minecraft.client.util.math.MatrixStack

@Environment(CLIENT) public class MatrixStack extends Object
A stack of transformation matrices used to specify how 3D objects are translated, scaled or rotated in 3D space. Each entry consists of a position matrix and its corresponding normal matrix.

By putting matrices in a stack, a transformation can be expressed relative to another. You can push, transform, render and pop, which allows you to restore the original matrix after rendering.

An entry of identity matrix is pushed when a stack is created. This means that a stack is empty if and only if the stack contains exactly one entry.

Mappings:
Namespace Name
named net/minecraft/client/util/math/MatrixStack
intermediary net/minecraft/class_4587
official fbi
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Deque<MatrixStack.Entry>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether this stack contains exactly one entry.
    void
    Sets the top entry to be the identity matrix.
    void
    multiply(Quaternionf quaternion)
    Applies the rotation transformation to the top entry.
    void
    multiply(Quaternionf quaternion, float originX, float originY, float originZ)
     
    void
    Multiplies the top position matrix with the given matrix.
    Returns the entry at the top of this stack.
    void
    pop()
    Removes the entry at the top of this stack.
    void
    Pushes a copy of the top entry onto this stack.
    void
    scale(float x, float y, float z)
    Applies the scale transformation to the top entry.
    void
    translate(double x, double y, double z)
    Applies the translation transformation to the top entry.
    void
    translate(float x, float y, float z)
     

    Methods inherited from class java.lang.Object

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

    • stack

      private final Deque<MatrixStack.Entry> stack
      Mappings:
      Namespace Name Mixin selector
      named stack Lnet/minecraft/client/util/math/MatrixStack;stack:Ljava/util/Deque;
      intermediary field_20898 Lnet/minecraft/class_4587;field_20898:Ljava/util/Deque;
      official a Lfbi;a:Ljava/util/Deque;
  • Constructor Details

    • MatrixStack

      public MatrixStack()
  • Method Details

    • translate

      public void translate(double x, double y, double z)
      Applies the translation transformation to the top entry.
      Mappings:
      Namespace Name Mixin selector
      named translate Lnet/minecraft/client/util/math/MatrixStack;translate(DDD)V
      intermediary method_22904 Lnet/minecraft/class_4587;method_22904(DDD)V
      official a Lfbi;a(DDD)V
    • translate

      public void translate(float x, float y, float z)
      Mappings:
      Namespace Name Mixin selector
      named translate Lnet/minecraft/client/util/math/MatrixStack;translate(FFF)V
      intermediary method_46416 Lnet/minecraft/class_4587;method_46416(FFF)V
      official a Lfbi;a(FFF)V
    • scale

      public void scale(float x, float y, float z)
      Applies the scale transformation to the top entry.
      Implementation Note:
      This does not scale the normal matrix correctly when the scaling is uniform and the scaling factor is negative.
      Mappings:
      Namespace Name Mixin selector
      named scale Lnet/minecraft/client/util/math/MatrixStack;scale(FFF)V
      intermediary method_22905 Lnet/minecraft/class_4587;method_22905(FFF)V
      official b Lfbi;b(FFF)V
    • multiply

      public void multiply(Quaternionf quaternion)
      Applies the rotation transformation to the top entry.
      Mappings:
      Namespace Name Mixin selector
      named multiply Lnet/minecraft/client/util/math/MatrixStack;multiply(Lorg/joml/Quaternionf;)V
      intermediary method_22907 Lnet/minecraft/class_4587;method_22907(Lorg/joml/Quaternionf;)V
      official a Lfbi;a(Lorg/joml/Quaternionf;)V
    • multiply

      public void multiply(Quaternionf quaternion, float originX, float originY, float originZ)
      Mappings:
      Namespace Name Mixin selector
      named multiply Lnet/minecraft/client/util/math/MatrixStack;multiply(Lorg/joml/Quaternionf;FFF)V
      intermediary method_49278 Lnet/minecraft/class_4587;method_49278(Lorg/joml/Quaternionf;FFF)V
      official a Lfbi;a(Lorg/joml/Quaternionf;FFF)V
    • push

      public void push()
      Pushes a copy of the top entry onto this stack.
      Mappings:
      Namespace Name Mixin selector
      named push Lnet/minecraft/client/util/math/MatrixStack;push()V
      intermediary method_22903 Lnet/minecraft/class_4587;method_22903()V
      official a Lfbi;a()V
    • pop

      public void pop()
      Removes the entry at the top of this stack.
      Mappings:
      Namespace Name Mixin selector
      named pop Lnet/minecraft/client/util/math/MatrixStack;pop()V
      intermediary method_22909 Lnet/minecraft/class_4587;method_22909()V
      official b Lfbi;b()V
    • peek

      public MatrixStack.Entry peek()
      Returns the entry at the top of this stack.
      Returns:
      the entry at the top of this stack
      Mappings:
      Namespace Name Mixin selector
      named peek Lnet/minecraft/client/util/math/MatrixStack;peek()Lnet/minecraft/client/util/math/MatrixStack$Entry;
      intermediary method_23760 Lnet/minecraft/class_4587;method_23760()Lnet/minecraft/class_4587$class_4665;
      official c Lfbi;c()Lfbi$a;
    • isEmpty

      public boolean isEmpty()
      Returns whether this stack contains exactly one entry.
      Returns:
      whether this stack contains exactly one entry
      Mappings:
      Namespace Name Mixin selector
      named isEmpty Lnet/minecraft/client/util/math/MatrixStack;isEmpty()Z
      intermediary method_22911 Lnet/minecraft/class_4587;method_22911()Z
      official d Lfbi;d()Z
    • loadIdentity

      public void loadIdentity()
      Sets the top entry to be the identity matrix.
      Mappings:
      Namespace Name Mixin selector
      named loadIdentity Lnet/minecraft/client/util/math/MatrixStack;loadIdentity()V
      intermediary method_34426 Lnet/minecraft/class_4587;method_34426()V
      official e Lfbi;e()V
    • multiplyPositionMatrix

      public void multiplyPositionMatrix(Matrix4f matrix)
      Multiplies the top position matrix with the given matrix.

      This does not update the normal matrix unlike other transformation methods.

      Mappings:
      Namespace Name Mixin selector
      named multiplyPositionMatrix Lnet/minecraft/client/util/math/MatrixStack;multiplyPositionMatrix(Lorg/joml/Matrix4f;)V
      intermediary method_34425 Lnet/minecraft/class_4587;method_34425(Lorg/joml/Matrix4f;)V
      official a Lfbi;a(Lorg/joml/Matrix4f;)V