Interface IClientAPI


@ParametersAreNonnullByDefault public interface IClientAPI
Definition for the JourneyMap Client API.
  • Field Details

  • Method Details

    • getUIState

      @Nullable UIState getUIState(Context.UI ui)
      Returns the current UIState of the UI specified.

      Note: Context.UI.Any is not a meaningful parameter value here and will just return null.

      Parameters:
      ui - Should be one of: Fullscreen, Minimap, or Webmap
      Returns:
      the current UIState of the UI specified.
    • show

      void show(Displayable displayable) throws Exception
      Add (or update) a displayable object to the player's maps. If you modify a Displayable after it has been added, call this method again to ensure the maps reflect your changes.

      If an object of the same Displayable.Type from your mod with the same displayId has already been added, it will be replaced.

      Has no effect on display types not accepted by the player.

      Parameters:
      displayable - The object to display.
      Throws:
      Exception - if the Displayable can't be shown.
      See Also:
    • remove

      void remove(Displayable displayable)
      Remove a displayable from the player's maps. Has no effect on display types not accepted by the player.
      Parameters:
      displayable - The object to display.
      See Also:
    • removeAll

      void removeAll(String modId, DisplayType displayType)
      Remove all displayables by DisplayType from the player's maps. Has no effect on display types not accepted by the player.
      Parameters:
      modId - Mod id
      displayType - Display type
      See Also:
    • removeAll

      void removeAll(String modId)
      Remove all displayables. Has no effect on display types not accepted by the player.
      Parameters:
      modId - Mod id
      See Also:
    • exists

      boolean exists(Displayable displayable)
      Check whether a displayable exists in the Client API. A return value of true means the Client API has the indicated displayable, but not necessarily that the player has made it visible.

      Always returns false if the display type is not accepted by the player.

      Parameters:
      displayable - the object
      See Also:
    • playerAccepts

      boolean playerAccepts(String modId, DisplayType displayType)
      Check whether player will accept a type of Displayable from your mod. (Like Displayables or Overlays).
      Parameters:
      modId - Mod id
      displayType - Display type to check
      Returns:
      true if player accepts addition/removal of displayables
      See Also:
    • requestMapTile

      void requestMapTile(String modId, net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, Context.MapType mapType, net.minecraft.world.level.ChunkPos startChunk, net.minecraft.world.level.ChunkPos endChunk, @Nullable Integer chunkY, int zoom, boolean showGrid, Consumer<com.mojang.blaze3d.platform.NativeImage> callback)
      Note: This method IS NOT SUPPORTED for most mods. Misuse will lead to severe performance issues. Talk to Techbrew if you need to use this function.

      Asynchonrously request a BufferedImage map tile from JourneyMap. Requests may be throttled, so use sparingly. The largest image size that will be returned is 512x512 px.

      Parameters:
      modId - Mod id
      dimension - The dimension
      mapType - The map type
      startChunk - The NW chunk of the tile.
      endChunk - The SW chunk of the tile.
      chunkY - The vertical chunk (slice) if the maptype isn't day/night/topo
      zoom - The zoom level (0-8)
      showGrid - Whether to include to include the chunk grid overlay
      callback - A callback function which will provide a BufferedImage when/if available. If it returns null, then no image available.
    • disableFeature

      void disableFeature(@Nullable net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dimension, Context.MapType mapType, boolean enable)
      Note: This method IS NOT SUPPORTED for most mods. Talk to Techbrew if you need to use this function.

      This call can be used to enable or disable map types and UIs in a specific dimension or all dimensions.

      Parameters:
      dimension - The dimension. Use null for all dimensions.
      mapType - The map type
      enable - True to enable, false to disable.
    • getDataPath

      @Nullable File getDataPath(String modId)
      This call gets the current user's data path for saving custom addon data specific to the game/world the user is playing in.

      This is only valid when Journeymap is mapping. Mods ideally should store this value on MappingEvent.Stage.MAPPING_STARTED event.

      Note: Will method return null if not in world or not mapping. The path is flushed right after MappingEvent.Stage.MAPPING_STOPPED

      Parameters:
      modId - The ModId
      Returns:
      a path similar to ./journeymap/data/{sp|mp}/{worldname}/addon-data/{modid}/
    • getAllWaypoints

      List<? extends Waypoint> getAllWaypoints()
      Returns all waypoints that journeymap has stored for the current game/server. Modifying these waypoints will not change anything in game, they are just a copy.
      Returns:
      - List of all waypoints.
    • getAllWaypoints

      List<? extends Waypoint> getAllWaypoints(net.minecraft.resources.ResourceKey<net.minecraft.world.level.Level> dim)
      Gets all waypoints for the provided dimension from all of journeymap's waypoints. Modifying these waypoints will not change anything in game, they are just a copy.
      Parameters:
      dim - - The dimension
      Returns:
      The waypoints.
    • getWaypoint

      @Nullable Waypoint getWaypoint(String modId, String guid)
      Gets the waypoint by display Id for the modId provided.
      Parameters:
      modId - - The modId
      guid - - The guid
      Returns:
      The waypoint.
    • getWaypoints

      List<? extends Waypoint> getWaypoints(String modId)
      Gets all waypoints for the provided modId
      Parameters:
      modId - - The modId
      Returns:
      the waypoint list
    • removeWaypoint

      void removeWaypoint(String modId, Waypoint waypoint)
      Remove a waypoint.
      Parameters:
      modId - - The modId
      waypoint - - the waypoint
    • addWaypoint

      void addWaypoint(String modId, Waypoint waypoint)
      Adds a waypoint
      Parameters:
      modId - - The modId
      waypoint - - the waypoint
    • removeAllWaypoints

      void removeAllWaypoints(String modId)
      Remove all waypoints.
      Parameters:
      modId - - The modId
    • addWaypointGroup

      void addWaypointGroup(WaypointGroup group)
      Adds a Waypoint group to the system.
    • getWaypointGroup

      WaypointGroup getWaypointGroup(String groupGuid)
      Gets a waypoint group from the group's guid.
      Parameters:
      groupGuid - the guid
      Returns:
      the group.
    • getWaypointGroupByName

      WaypointGroup getWaypointGroupByName(String modId, String name)
      Gets a waypoint group from the name. (not case-sensitive) If multiple are found, returns the first one.
      Parameters:
      modId - the modId
      name - the group name
      Returns:
      the group.
    • getWaypointGroups

      List<? extends WaypointGroup> getWaypointGroups(String modId)
      Gets all waypoint groups for a modid.
      Parameters:
      modId - the modId
      Returns:
      the immutable list of groups
    • getAllWaypointGroups

      List<? extends WaypointGroup> getAllWaypointGroups()
      Gets an immutable list of all waypoint groups.
      Returns:
      the immutable list of groups
    • removeWaypointGroup

      void removeWaypointGroup(WaypointGroup group, boolean deleteWaypoints)
      Removes a waypoint group. Setting deleteWaypoints to false, will move all waypoints in the Default group.
      Parameters:
      group - the group
      deleteWaypoints - to delete all waypoints in group
    • removeWaypointGroups

      void removeWaypointGroups(String modId, boolean deleteWaypoints)
      Removes groups for a modId. Setting deleteWaypoints to false, will move all waypoints in the Default group.
      Parameters:
      modId - - the modId
      deleteWaypoints - to delete all waypoints in group
    • getWorldId

      String getWorldId()
      Gets the worldId for the current world.
      Returns:
      worldId.
    • toggleMinimap

      void toggleMinimap(boolean enable)
      Toggles the minimmap display
      Parameters:
      enable - - enable or disable
    • minimapEnabled

      boolean minimapEnabled()
      Gets the minimap enabled or disabled state
      Returns:
      - true or false