Class PolygonOverlay

All Implemented Interfaces:
Comparable<Displayable>

@ParametersAreNonnullByDefault public final class PolygonOverlay extends Overlay
A polygon overlay displays a geometric area on a map. For example: An area of claimed chunks.

Setters use the Builder pattern so they can be chained.

Note that like all Displayables, simply changing this object doesn't guarantee the player will get the changes. You must call IClientAPI.show(Displayable) in order for the changes to take effect in JourneyMap.

  • Constructor Details

    • PolygonOverlay

      public PolygonOverlay(String modId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, ShapeProperties shapeProperties, MapPolygon outerArea)
      Constructor.
      Parameters:
      modId - Your mod id.
      outerArea - A polygon of the outer area to be displayed.
    • PolygonOverlay

      public PolygonOverlay(String modId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, ShapeProperties shapeProperties, MapPolygonWithHoles polygon)
      Constructor.
      Parameters:
      modId - Your mod id.
      polygon - A polygon of the outer area with holes to be displayed.
    • PolygonOverlay

      public PolygonOverlay(String modId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, ShapeProperties shapeProperties, MapPolygon outerArea, @Nullable List<MapPolygon> holes)
      Constructor.
      Parameters:
      modId - Your mod id.
      outerArea - A polygon of the outer area to be displayed.
      holes - (Optional) A list of polygons treated as holes inside the outerArea
  • Method Details

    • getOuterArea

      public MapPolygon getOuterArea()
      A polygon of the outer area to be displayed.
      Returns:
      the outer area
    • setOuterArea

      public PolygonOverlay setOuterArea(MapPolygon outerArea)
      Sets the polygon of the outer area to be displayed.
      Parameters:
      outerArea - polygon
      Returns:
      this
    • getHoles

      public List<MapPolygon> getHoles()
      (optional) A list of polygons treated as holes inside the outerArea
      Returns:
      null if none specified
    • setHoles

      public PolygonOverlay setHoles(@Nullable List<MapPolygon> holes)
      Sets a list of polygons treated as holes inside the outerArea
      Parameters:
      holes - polygons
      Returns:
      this
    • setPolygonWithHoles

      public PolygonOverlay setPolygonWithHoles(MapPolygonWithHoles polygon)
      Sets the outer area and holes in one go.
    • getShapeProperties

      public ShapeProperties getShapeProperties()
      Gets the shape properties used to display the polygons.
      Returns:
      properties
    • setShapeProperties

      public PolygonOverlay setShapeProperties(ShapeProperties shapeProperties)
      Sets the shape properties used to display the polygons.
      Parameters:
      shapeProperties - properties
      Returns:
      this
    • toString

      public String toString()
      Overrides:
      toString in class Object