Package io.github.toxicity188.javamesh
Record Class MeshShape
java.lang.Object
java.lang.Record
io.github.toxicity188.javamesh.MeshShape
- Record Components:
points- polygon points in winding ordertexture- optional texture name referenced by the source mesh material
public record MeshShape(@NotNull @Unmodifiable List<MeshPoint> points, @Nullable String texture)
extends Record
Polygon data extracted from a mesh source before conversion into Minecraft triangle models.
A shape contains at least three points and an optional texture reference. During conversion it is triangulated and each triangle becomes one or more Minecraft model elements.
MeshShape quad = new MeshShape(List.of(p0, p1, p2, p3), "blade.png");
- Since:
- 0.0.1
-
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.static @NotNull MeshShapeCreates an untextured polygon from the provided points.points()Returns the value of thepointsrecord component.@Nullable Stringtexture()Returns the value of thetexturerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MeshShape
public MeshShape(@NotNull @NotNull @Unmodifiable List<MeshPoint> points, @Nullable @Nullable String texture) Validates polygon data for mesh conversion.- Throws:
IllegalArgumentException- if fewer than three points are supplied- Since:
- 0.0.1
-
-
Method Details
-
of
Creates an untextured polygon from the provided points.- Parameters:
points- polygon points in winding order- Returns:
- a new shape without a texture reference
- Throws:
NullPointerException- ifpointsisnullIllegalArgumentException- if fewer than three points are supplied- Since:
- 0.0.1
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
points
Returns the value of thepointsrecord component.- Returns:
- the value of the
pointsrecord component
-
texture
Returns the value of thetexturerecord component.- Returns:
- the value of the
texturerecord component
-