Record Class ServerPolygon

java.lang.Object
java.lang.Record
journeymap.api.v2.server.overlay.ServerPolygon
Record Components:
overlayId - the addon-stable handle for this overlay
dimension - the dimension this overlay belongs to
polygons - one or more polygons, all sharing the same shape props
props - style and visibility for every polygon in this overlay

public record ServerPolygon(String overlayId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, List<OverlayPolygon> polygons, OverlayShapeProps props) extends Record
One logical overlay pushed by a server addon. May contain many disjoint OverlayPolygons sharing one set of OverlayShapeProps.

The overlayId is a stable, addon-chosen string. Re-calling IServerOverlayAPI.show(net.minecraft.server.level.ServerPlayer, java.lang.String, journeymap.api.v2.server.overlay.ServerPolygon...) with the same (modId, overlayId) pair replaces any prior version on the client; calling IServerOverlayAPI.remove(net.minecraft.server.level.ServerPlayer, java.lang.String, java.lang.String) removes it.

  • Constructor Details

    • ServerPolygon

      public ServerPolygon(String overlayId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, List<OverlayPolygon> polygons, OverlayShapeProps props)
      Creates an instance of a ServerPolygon record class.
      Parameters:
      overlayId - the value for the overlayId record component
      dimension - the value for the dimension record component
      polygons - the value for the polygons record component
      props - the value for the props record component
  • Method Details

    • 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.
    • overlayId

      public String overlayId()
      Returns the value of the overlayId record component.
      Returns:
      the value of the overlayId record component
    • dimension

      public net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension()
      Returns the value of the dimension record component.
      Returns:
      the value of the dimension record component
    • polygons

      public List<OverlayPolygon> polygons()
      Returns the value of the polygons record component.
      Returns:
      the value of the polygons record component
    • props

      public OverlayShapeProps props()
      Returns the value of the props record component.
      Returns:
      the value of the props record component