Record Class ParticleShape

java.lang.Object
java.lang.Record
forgottentowns.mod.api.ParticleShape
Record Components:
vertices - counterclockwise polygon vertices around the origin, between three and sixteen

public record ParticleShape(List<ParticleShape.Point> vertices) extends Record
Convex particle silhouette, reused by ordinary and body-masked drawing.
  • Constructor Details

    • ParticleShape

      public ParticleShape(List<ParticleShape.Point> vertices)
      Copies and validates a convex polygon containing the origin.
      Parameters:
      vertices - counterclockwise normalized vertices
      Throws:
      IllegalArgumentException - if vertices is null, contains null, has fewer than three or more than sixteen entries, fails counterclockwise origin containment, or is nonconvex
  • Method Details

    • contains

      public boolean contains(double x, double y)
      Tests the same silhouette used by the renderer's clipping path.
      Parameters:
      x - finite normalized horizontal query coordinate
      y - finite normalized vertical query coordinate
      Returns:
      true when no edge places the point strictly outside, including polygon boundaries; nonfinite inputs are not validated and must not be supplied
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • vertices

      public List<ParticleShape.Point> vertices()
      Returns the value of the vertices record component.
      Returns:
      the value of the vertices record component