Class RootTransformsBuilder

java.lang.Object
net.neoforged.neoforge.client.model.generators.template.RootTransformsBuilder

public class RootTransformsBuilder extends Object
  • Field Details

    • ONE

      private static final org.joml.Vector3f ONE
    • translation

      private org.joml.Vector3f translation
    • leftRotation

      private org.joml.Quaternionf leftRotation
    • rightRotation

      private org.joml.Quaternionf rightRotation
    • scale

      private org.joml.Vector3f scale
    • origin

      @Nullable private TransformationHelper.TransformOrigin origin
    • originVec

      @Nullable private @Nullable org.joml.Vector3f originVec
  • Constructor Details

    • RootTransformsBuilder

      public RootTransformsBuilder()
  • Method Details

    • translation

      public RootTransformsBuilder translation(org.joml.Vector3f translation)
      Sets the translation of the root transform.
      Parameters:
      translation - the translation
      Returns:
      this builder
      Throws:
      NullPointerException - if translation is null
    • translation

      public RootTransformsBuilder translation(float x, float y, float z)
      Sets the translation of the root transform.
      Parameters:
      x - x translation
      y - y translation
      z - z translation
      Returns:
      this builder
    • rotation

      public RootTransformsBuilder rotation(org.joml.Quaternionf rotation)
      Sets the left rotation of the root transform.
      Parameters:
      rotation - the left rotation
      Returns:
      this builder
      Throws:
      NullPointerException - if rotation is null
    • rotation

      public RootTransformsBuilder rotation(float x, float y, float z, boolean isDegrees)
      Sets the left rotation of the root transform.
      Parameters:
      x - x rotation
      y - y rotation
      z - z rotation
      isDegrees - whether the rotation is in degrees or radians
      Returns:
      this builder
    • leftRotation

      public RootTransformsBuilder leftRotation(org.joml.Quaternionf leftRotation)
      Sets the left rotation of the root transform.
      Parameters:
      leftRotation - the left rotation
      Returns:
      this builder
      Throws:
      NullPointerException - if leftRotation is null
    • leftRotation

      public RootTransformsBuilder leftRotation(float x, float y, float z, boolean isDegrees)
      Sets the left rotation of the root transform.
      Parameters:
      x - x rotation
      y - y rotation
      z - z rotation
      isDegrees - whether the rotation is in degrees or radians
      Returns:
      this builder
    • rightRotation

      public RootTransformsBuilder rightRotation(org.joml.Quaternionf rightRotation)
      Sets the right rotation of the root transform.
      Parameters:
      rightRotation - the right rotation
      Returns:
      this builder
      Throws:
      NullPointerException - if rightRotation is null
    • rightRotation

      public RootTransformsBuilder rightRotation(float x, float y, float z, boolean isDegrees)
      Sets the right rotation of the root transform.
      Parameters:
      x - x rotation
      y - y rotation
      z - z rotation
      isDegrees - whether the rotation is in degrees or radians
      Returns:
      this builder
    • postRotation

      public RootTransformsBuilder postRotation(org.joml.Quaternionf postRotation)
      Sets the right rotation of the root transform.
      Parameters:
      postRotation - the right rotation
      Returns:
      this builder
      Throws:
      NullPointerException - if rightRotation is null
    • postRotation

      public RootTransformsBuilder postRotation(float x, float y, float z, boolean isDegrees)
      Sets the right rotation of the root transform.
      Parameters:
      x - x rotation
      y - y rotation
      z - z rotation
      isDegrees - whether the rotation is in degrees or radians
      Returns:
      this builder
    • scale

      public RootTransformsBuilder scale(float scale)
      Sets the scale of the root transform.
      Parameters:
      scale - the scale
      Returns:
      this builder
    • scale

      public RootTransformsBuilder scale(float xScale, float yScale, float zScale)
      Sets the scale of the root transform.
      Parameters:
      xScale - x scale
      yScale - y scale
      zScale - z scale
      Returns:
      this builder
    • scale

      public RootTransformsBuilder scale(org.joml.Vector3f scale)
      Sets the scale of the root transform.
      Parameters:
      scale - the scale vector
      Returns:
      this builder
      Throws:
      NullPointerException - if scale is null
    • transform

      public RootTransformsBuilder transform(com.mojang.math.Transformation transformation)
      Sets the root transform.
      Parameters:
      transformation - the transformation to use
      Returns:
      this builder
      Throws:
      NullPointerException - if transformation is null
    • origin

      public RootTransformsBuilder origin(org.joml.Vector3f origin)
      Sets the origin of the root transform.
      Parameters:
      origin - the origin vector
      Returns:
      this builder
      Throws:
      NullPointerException - if origin is null
    • origin

      Sets the origin of the root transform.
      Parameters:
      origin - the origin name
      Returns:
      this builder
      Throws:
      NullPointerException - if origin is null
      IllegalArgumentException - if origin is not center, corner or opposing-corner
    • toJson

      com.google.gson.JsonObject toJson()
    • writeVec3

      private static com.google.gson.JsonArray writeVec3(org.joml.Vector3f vector)
    • writeQuaternion

      private static com.google.gson.JsonArray writeQuaternion(org.joml.Quaternionf quaternion)
    • copyFrom

      void copyFrom(RootTransformsBuilder other)