Class Overlay

java.lang.Object
journeymap.api.v2.client.display.Displayable
journeymap.api.v2.client.display.Overlay
All Implemented Interfaces:
Comparable<Displayable>
Direct Known Subclasses:
ImageOverlay, MarkerOverlay, PolygonOverlay

@ParametersAreNonnullByDefault public abstract class Overlay extends Displayable
Provides IDs and key information for map overlays in JourneyMap.
  • Field Details

    • overlayGroupName

      protected String overlayGroupName
    • title

      protected String title
    • label

      protected String label
    • dimension

      protected net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension
    • minZoom

      protected int minZoom
    • maxZoom

      protected int maxZoom
    • displayOrder

      protected int displayOrder
    • activeUIs

      protected Set<Context.UI> activeUIs
    • activeMapTypes

      protected Set<Context.MapType> activeMapTypes
    • textProperties

      protected TextProperties textProperties
    • overlayListener

      protected IOverlayListener overlayListener
    • needsRerender

      protected boolean needsRerender
  • Method Details

    • getDimension

      public net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> getDimension()
      The dimension this overlay should be displayed in.
      Returns:
      dimension id
    • setDimension

      public Overlay setDimension(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension)
      Sets dimension.
      Parameters:
      dimension - the dimension
      Returns:
      this
    • getOverlayGroupName

      public String getOverlayGroupName()
      A suggested group or category name used to organize map overlays.
      Returns:
      the overlay group name
    • setOverlayGroupName

      public Overlay setOverlayGroupName(String overlayGroupName)
      A suggested group or category name used to organize map overlays.
      Parameters:
      overlayGroupName - the overlay group name
      Returns:
      this
    • getTitle

      public String getTitle()
      Rollover text to be displayed when the mouse is over the overlay.
      Returns:
      the title
    • setTitle

      public Overlay setTitle(@Nullable String title)
      Rollover text to be displayed when the mouse is over the overlay.
      Parameters:
      title - the title
      Returns:
      this
    • getLabel

      public String getLabel()
      Label text to be displayed on the overlay.
      Returns:
      the label
    • setLabel

      public Overlay setLabel(@Nullable String label)
      Label text to be displayed on the overlay.
      Parameters:
      label - the label
      Returns:
      this
    • getMinZoom

      public int getMinZoom()
      The minimum zoom level (UIState.FULLSCREEN_ZOOM_MIN is lowest) where the overlay should be visible.
      Returns:
      the min zoom
    • setMinZoom

      public Overlay setMinZoom(int minZoom)
      Sets the minimum zoom level (UIState.FULLSCREEN_ZOOM_MIN is lowest) where the overlay should be visible.
      Parameters:
      minZoom - the min zoom
      Returns:
      this
    • getMaxZoom

      public int getMaxZoom()
      The maximum zoom level (UIState.ZOOM_IN_MAX is highest) where the overlay should be visible.
      Returns:
      the max zoom
    • setMaxZoom

      public Overlay setMaxZoom(int maxZoom)
      Sets the maximum zoom level (UIState.ZOOM_IN_MAX is highest) where the overlay should be visible.
      Parameters:
      maxZoom - the max zoom
      Returns:
      this
    • getDisplayOrder

      public int getDisplayOrder()
      Any features are displayed on the map in order of their screen displayOrder, with higher values displaying in front of features with lower values. Default is 1000.
      Specified by:
      getDisplayOrder in class Displayable
      Returns:
      the z index
    • setDisplayOrder

      public Overlay setDisplayOrder(int zIndex)
      Any features are displayed on the map in order of their screen displayOrder, with higher values displaying in front of features with lower values. Default is 1000.
      Parameters:
      zIndex - the z index
      Returns:
      this
    • getTextProperties

      public TextProperties getTextProperties()
      Gets the text properties for the overlay.
      Returns:
      properties
    • setTextProperties

      public Overlay setTextProperties(TextProperties textProperties)
      Sets the text properties for the overlay.
      Parameters:
      textProperties - properties
      Returns:
      this
    • getActiveUIs

      public Set<Context.UI> getActiveUIs()
      Returns a set of enums indicating which JourneyMap UIs (Fullscreen, Minimap, Webmap) the overlay should be active in.
      Returns:
      enumset
    • setActiveUIs

      public Overlay setActiveUIs(Context.UI... activeUIs)
      Set of enums indicating which JourneyMap UIs (Fullscreen, Minimap, Webmap) the overlay should be active in.
      Parameters:
      activeUIs - active UIs
      Returns:
      this
    • getActiveMapTypes

      public Set<Context.MapType> getActiveMapTypes()
      Returns a set of enums indicating which map types (Day, Night) the overlay should be active in.
      Returns:
      enumset
    • setActiveMapTypes

      public Overlay setActiveMapTypes(Context.MapType... activeMapTypes)
      Set of enums indicating which JourneyMap map types (Day, Night) the overlay should be active in.
      Parameters:
      activeMapTypes - active types
      Returns:
      this
    • isActiveIn

      public boolean isActiveIn(UIState uiState)
      Whether the overlay should be active for the given contexts.
      Parameters:
      uiState - UIState
      Returns:
      true if the overlay should be active
    • isInZoomRange

      public boolean isInZoomRange(UIState uiState)
      Whether the zoom of the given context is within the zoom range of the overlay.
      Parameters:
      uiState - UIState
      Returns:
      true if the zoom of uiState is within the zoom range of the overlay
    • getOverlayListener

      public IOverlayListener getOverlayListener()
      Gets the listener for user events on the overlay.
      Returns:
      listener impl or null
    • setOverlayListener

      public Overlay setOverlayListener(@Nullable IOverlayListener overlayListener)
      Sets a listener for receiving user events related to the Overlay.
      Parameters:
      overlayListener - IOverlayListener impl
      Returns:
      this
    • flagForRerender

      public void flagForRerender()
      Indicate the overlay needs to be re-rendered. Typically you don't need to use this unless you are updating an overlay dynamically and the chances aren't shown until the map is panned or zoomed. For example within and IOverlayListener. Overusing this can cause performance problems.
    • clearFlagForRerender

      public void clearFlagForRerender()
      Used by JourneyMap after the overlay has been re-rendered.
    • getNeedsRerender

      public boolean getNeedsRerender()
      Gets whether the overlay needs to be re-rendered.
      Returns:
      true if rerender needed
    • toStringHelper

      protected final com.google.common.base.MoreObjects.ToStringHelper toStringHelper(Overlay instance)
      Provides common output for toStringHelper() to subclasses
      Parameters:
      instance - subclass
      Returns:
      helper for continuing to add properties on subclass