Record Class ModelUV

java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelUV
Record Components:
uv - the UV coordinates as a Float4 (u1, v1, u2, v2)
rotation - the rotation of the UV map in degrees (0, 90, 180, 270)
texture - the JSON element representing the texture index, can be null

public record ModelUV(@NotNull Float4 uv, int rotation, @Nullable com.google.gson.JsonElement texture) extends Record
Represents the UV mapping data for a model face.

This record holds the UV coordinates, rotation, and texture index for a specific face of a model element.

Since:
1.15.2
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModelUV(@NotNull Float4 uv, int rotation, @Nullable com.google.gson.JsonElement texture)
    Creates an instance of a ModelUV record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Checks if this UV mapping has a valid texture index.
    int
    Returns the value of the rotation record component.
    @Nullable com.google.gson.JsonElement
    Returns the value of the texture record component.
    int
    Returns the texture index associated with this UV mapping.
    @Nullable com.google.gson.JsonObject
    toJson(@NotNull BlueprintLoadContext context, int tint)
    Converts this UV data to a JSON object for the Minecraft model file.
    final String
    Returns a string representation of this record class.
    @NotNull Float4
    uv()
    Returns the value of the uv record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ModelUV

      public ModelUV(@NotNull @NotNull Float4 uv, int rotation, @Nullable @Nullable com.google.gson.JsonElement texture)
      Creates an instance of a ModelUV record class.
      Parameters:
      uv - the value for the uv record component
      rotation - the value for the rotation record component
      texture - the value for the texture record component
  • Method Details

    • hasTexture

      public boolean hasTexture()
      Checks if this UV mapping has a valid texture index.
      Returns:
      true if a texture is defined, false otherwise
      Since:
      1.15.2
    • textureIndex

      public int textureIndex()
      Returns the texture index associated with this UV mapping.
      Returns:
      the texture index
      Throws:
      NullPointerException - if no texture is defined
      Since:
      1.15.2
    • toJson

      @Nullable public @Nullable com.google.gson.JsonObject toJson(@NotNull @NotNull BlueprintLoadContext context, int tint)
      Converts this UV data to a JSON object for the Minecraft model file.
      Parameters:
      context - the blueprint context, used for texture resolution
      tint - the tint index to apply
      Returns:
      the generated JSON object
      Since:
      1.15.2
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • uv

      @NotNull public @NotNull Float4 uv()
      Returns the value of the uv record component.
      Returns:
      the value of the uv record component
    • rotation

      public int rotation()
      Returns the value of the rotation record component.
      Returns:
      the value of the rotation record component
    • texture

      @Nullable public @Nullable com.google.gson.JsonElement texture()
      Returns the value of the texture record component.
      Returns:
      the value of the texture record component