Package kr.toxicity.model.api.data.raw
Record Class ModelUV
java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelUV
- Record Components:
uv- the UV coordinates as aFloat4(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, float 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 -
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.booleanChecks if this UV mapping has a valid texture index.floatrotation()Returns the value of therotationrecord component.@Nullable com.google.gson.JsonElementtexture()Returns the value of thetexturerecord component.intReturns the texture index associated with this UV mapping.@NotNull com.google.gson.JsonObjecttoJson(@NotNull ModelBlueprint parent, int tint) Converts this UV data to a JSON object for the Minecraft model file.final StringtoString()Returns a string representation of this record class.@NotNull Float4uv()Returns the value of theuvrecord component.
-
Constructor Details
-
ModelUV
public ModelUV(@NotNull @NotNull Float4 uv, float rotation, @Nullable @Nullable com.google.gson.JsonElement texture) Creates an instance of aModelUVrecord class.
-
-
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
@NotNull public @NotNull com.google.gson.JsonObject toJson(@NotNull @NotNull ModelBlueprint parent, int tint) Converts this UV data to a JSON object for the Minecraft model file.- Parameters:
parent- the parent model blueprint, used for texture resolutiontint- the tint index to apply- Returns:
- the generated JSON object
- Since:
- 1.15.2
-
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 '=='. -
uv
Returns the value of theuvrecord component.- Returns:
- the value of the
uvrecord component
-
rotation
public float rotation()Returns the value of therotationrecord component.- Returns:
- the value of the
rotationrecord component
-
texture
@Nullable public @Nullable com.google.gson.JsonElement texture()Returns the value of thetexturerecord component.- Returns:
- the value of the
texturerecord component
-