java.lang.Object
io.github.cottonmc.cotton.gui.widget.data.Texture

public final class Texture extends Object
Represents a texture for a widget.
Since:
3.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    net.minecraft.util.Identifier
    The image of this texture.
    float
    The UV coordinates of this texture, between 0 and 1.
    float
    The UV coordinates of this texture, between 0 and 1.
    float
    The UV coordinates of this texture, between 0 and 1.
    float
    The UV coordinates of this texture, between 0 and 1.
  • 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
    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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • image

      public final net.minecraft.util.Identifier image
      The image of this texture.
    • u1

      public final float u1
      The UV coordinates of this texture, between 0 and 1.
    • v1

      public final float v1
      The UV coordinates of this texture, between 0 and 1.
    • u2

      public final float u2
      The UV coordinates of this texture, between 0 and 1.
    • v2

      public final float v2
      The UV coordinates of this texture, between 0 and 1.
  • 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