Record Class Texture

java.lang.Object
java.lang.Record
io.github.cottonmc.cotton.gui.widget.data.Texture
Record Components:
image - the image of this texture
u1 - the start U-coordinate, between 0 and 1
v1 - the start V-coordinate, between 0 and 1
u2 - the end U-coordinate, between 0 and 1
v2 - the end V-coordinate, between 0 and 1

public record Texture(net.minecraft.util.Identifier image, float u1, float v1, float u2, float v2) extends Record
Represents a texture for a widget.
Since:
3.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Texture(net.minecraft.util.Identifier image)
    Constructs a new texture that uses the full image.
    Texture(net.minecraft.util.Identifier image, float u1, float v1, float u2, float v2)
    Constructs a new texture with custom UV values.
  • 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.
    net.minecraft.util.Identifier
    Returns the value of the image record component.
    final String
    Returns a string representation of this record class.
    float
    u1()
    Returns the value of the u1 record component.
    float
    u2()
    Returns the value of the u2 record component.
    float
    v1()
    Returns the value of the v1 record component.
    float
    v2()
    Returns the value of the v2 record component.
    withUv(float u1, float v1, float u2, float v2)
    Creates a new texture with different UV values.

    Methods inherited from class java.lang.Object

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

    • Texture

      public Texture(net.minecraft.util.Identifier image)
      Constructs a new texture that uses the full image.
      Parameters:
      image - the image
      Throws:
      NullPointerException - if the image is null
    • Texture

      public Texture(net.minecraft.util.Identifier image, float u1, float v1, float u2, float v2)
      Constructs a new texture with custom UV values.
      Parameters:
      image - the image
      u1 - the left U coordinate
      v1 - the top V coordinate
      u2 - the right U coordinate
      v2 - the bottom V coordinate
      Throws:
      NullPointerException - if the image is null
  • Method Details

    • withUv

      public Texture withUv(float u1, float v1, float u2, float v2)
      Creates a new texture with different UV values.
      Parameters:
      u1 - the left U coordinate
      v1 - the top V coordinate
      u2 - the right U coordinate
      v2 - the bottom V coordinate
      Returns:
      the created texture
    • 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 '=='.
      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.
    • image

      public net.minecraft.util.Identifier image()
      Returns the value of the image record component.
      Returns:
      the value of the image record component
    • u1

      public float u1()
      Returns the value of the u1 record component.
      Returns:
      the value of the u1 record component
    • v1

      public float v1()
      Returns the value of the v1 record component.
      Returns:
      the value of the v1 record component
    • u2

      public float u2()
      Returns the value of the u2 record component.
      Returns:
      the value of the u2 record component
    • v2

      public float v2()
      Returns the value of the v2 record component.
      Returns:
      the value of the v2 record component