Record Class Texture
java.lang.Object
java.lang.Record
io.github.cottonmc.cotton.gui.widget.data.Texture
- Record Components:
image- the image of this textureu1- the start U-coordinate, between 0 and 1v1- the start V-coordinate, between 0 and 1u2- the end U-coordinate, between 0 and 1v2- 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 -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.util.Identifierimage()Returns the value of theimagerecord component.final StringtoString()Returns a string representation of this record class.floatu1()Returns the value of theu1record component.floatu2()Returns the value of theu2record component.floatv1()Returns the value of thev1record component.floatv2()Returns the value of thev2record component.withUv(float u1, float v1, float u2, float v2) Creates a new texture with different UV values.
-
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 imageu1- the left U coordinatev1- the top V coordinateu2- the right U coordinatev2- the bottom V coordinate- Throws:
NullPointerException- if the image is null
-
-
Method Details
-
withUv
Creates a new texture with different UV values.- Parameters:
u1- the left U coordinatev1- the top V coordinateu2- the right U coordinatev2- the bottom V coordinate- Returns:
- the created texture
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
image
public net.minecraft.util.Identifier image()Returns the value of theimagerecord component.- Returns:
- the value of the
imagerecord component
-
u1
public float u1()Returns the value of theu1record component.- Returns:
- the value of the
u1record component
-
v1
public float v1()Returns the value of thev1record component.- Returns:
- the value of the
v1record component
-
u2
public float u2()Returns the value of theu2record component.- Returns:
- the value of the
u2record component
-
v2
public float v2()Returns the value of thev2record component.- Returns:
- the value of the
v2record component
-