Datensatzklasse RegionFootprint

java.lang.Object
java.lang.Record
de.delinkedde.areashopreborn.domain.RegionFootprint
Datensatzkomponenten:
vertices - ordered polygon vertices

public record RegionFootprint(List<FootprintPoint> vertices) extends Record
Immutable, hole-free polygon describing a region on the horizontal X/Z plane.

The implementation deliberately uses the same integer polygon model as WorldGuard. Therefore containment and union results can be transferred to a ProtectedPolygonalRegion without a second geometry interpretation.

  • Konstruktordetails

    • RegionFootprint

      public RegionFootprint(List<FootprintPoint> vertices)
      Validates and freezes the supplied polygon.
      Löst aus:
      IllegalArgumentException - when fewer than three effective vertices exist or the polygon has no horizontal area
  • Methodendetails

    • rectangle

      public static RegionFootprint rectangle(CuboidBounds bounds)
      Creates the rectangular footprint of inclusive cuboid bounds.
      Parameter:
      bounds - source cuboid
      Gibt zurück:
      ordered rectangular footprint
    • strictRectangle

      public static RegionFootprint strictRectangle(CuboidBounds bounds)
      Creates a rectangular footprint while rejecting a line-shaped selection.
      Parameter:
      bounds - source cuboid
      Gibt zurück:
      rectangular footprint
    • union

      public RegionFootprint union(RegionFootprint other)
      Combines this footprint with another footprint.
      Parameter:
      other - footprint to add
      Gibt zurück:
      one connected, hole-free union polygon
      Löst aus:
      IllegalArgumentException - when the result is disconnected, contains a hole, or cannot be represented by one WorldGuard polygon
    • contains

      public boolean contains(int x, int z)
      Tests whether the supplied block column lies in this polygon, including its edges.
      Parameter:
      x - block X coordinate
      z - block Z coordinate
      Gibt zurück:
      true when the point is inside or on an edge
    • isOnBoundary

      public boolean isOnBoundary(int x, int z)
      Tests whether a block column lies directly on a polygon edge.
      Parameter:
      x - block X coordinate
      z - block Z coordinate
      Gibt zurück:
      true when the point lies on any boundary segment
    • contains

      public boolean contains(RegionFootprint other)
      Tests whether this footprint completely covers another footprint.
      Parameter:
      other - candidate child footprint
      Gibt zurück:
      true when subtracting this polygon leaves no candidate block
    • overlaps

      public boolean overlaps(RegionFootprint other)
      Tests whether this footprint and another footprint share at least one block column.
      Parameter:
      other - other footprint
      Gibt zurück:
      true when both polygons protect a common block
    • sharesBoundaryEdge

      public boolean sharesBoundaryEdge(RegionFootprint other)
      Tests whether two polygons are block-adjacent along a shared edge.

      Directly neighbouring blocks count as a shared edge; touching only at a corner does not.

      Parameter:
      other - other footprint
      Gibt zurück:
      true for a shared edge, but not for corner-only contact
    • hasSameShapeAs

      public boolean hasSameShapeAs(RegionFootprint other)
      Compares two polygons by shape instead of by vertex list identity.

      WorldGuard may return the same ring starting at a different vertex or in the opposite winding order. Reconciliation must not report such a representation difference as a real geometry mismatch.

      Parameter:
      other - footprint to compare
      Gibt zurück:
      true when both polygons describe the same ring
    • bounds

      public CuboidBounds bounds(int minY, int maxY)
      Returns the smallest inclusive cuboid containing this footprint at the supplied heights.
      Parameter:
      minY - minimum build height
      maxY - maximum build height
      Gibt zurück:
      bounding cuboid
    • area

      public long area()
      Calculates the number of block columns this footprint protects.
      Gibt zurück:
      non-negative block count
    • toString

      public final String toString()
      Gibt eine Zeichenfolgendarstellung dieser Datensatzklasse zurück. Die Darstellung enthält den Namen der Klasse, gefolgt vom Namen und Wert jeder der Datensatzkomponenten.
      Angegeben von:
      toString in Klasse Record
      Gibt zurück:
      eine Zeichenfolgendarstellung dieses Objekts
    • hashCode

      public final int hashCode()
      Gibt einen Hashcodewert für diese Objekt zurück. Der Wert wird vom Hashcode jeder der Datensatzkomponenten abgeleitet.
      Angegeben von:
      hashCode in Klasse Record
      Gibt zurück:
      ein Hashcodewert für dieses Objekt
    • equals

      public final boolean equals(Object o)
      Gibt an, ob ein anderes Objekt diesem gleich ("equal to") ist. Die Objekte sind gleich, wenn das andere Objekt der gleichen Klasse angehört und alle Datensatzkomponenten gleich sind. Alle Komponenten in dieser Datensatzklasse werden verglichen mit Objects::equals(Object,Object).
      Angegeben von:
      equals in Klasse Record
      Parameter:
      o - das Objekt, mit dem verglichen wird
      Gibt zurück:
      true, wenn dieses Objekt gleich dem Argument o ist, andernfalls false.
    • vertices

      public List<FootprintPoint> vertices()
      Gibt den Wert für die Datensatzkomponente vertices zurück.
      Gibt zurück:
      Wert der Datensatzkomponente vertices