WorldMapAPI
A utility class providing methods to interact with the floating world map in RuneLite.
ClassRLPlugins API
public class WorldMapAPIThis class includes functions to convert screen coordinates to world points, check if the world map is open, draw markers and images on the map, and more. It is designed to facilitate plugin development that requires interaction with the world map interface.
Members
Static methods
- WorldPointconvertMapClickToWorldPoint(Client, int, int)
Converts world map click coordinates to a WorldPoint.
- WorldPointconvertMapClickToWorldPoint(Client, int, int, int)
Converts world map click coordinates to a WorldPoint with specific plane.
- voiddrawGreenMapMarker(Graphics2D, WorldPoint)
Convenience method to draw a standard-sized cyan marker.
- voiddrawImageAtWorldPoint(Graphics2D, WorldPoint, BufferedImage, int, int, int, int)
Draws a BufferedImage at a WorldPoint on the floating world map with customizable offset.
- voiddrawImageAtWorldPointCentered(Graphics2D, WorldPoint, BufferedImage, int, int)
Convenience method to draw a BufferedImage centered over a WorldPoint.
- voiddrawMapMarker(Graphics2D, WorldPoint, Color, int)
Draws a smooth, fluid teardrop/pin marker pointing to a WorldPoint on the floating world map.
- voiddrawPath(Graphics2D, List<WorldPoint>, Color)
Draws a path of colored squares on the floating world map at the specified world points.
- voiddrawRedMapMarker(Graphics2D, WorldPoint)
Convenience method to draw a standard-sized red marker.
- booleanisClickWithinMapBounds(Client, int, int)
Checks if the given screen coordinates are within the world map bounds.
- booleanisWorldMapOpen(Client)
Checks if the world map is currently open and ready for coordinate conversion.
- IntegermapWorldPointToScreenX(Client, WorldPoint)
Converts a WorldPoint to the corresponding screen X coordinate on the world map.
- IntegermapWorldPointToScreenY(Client, WorldPoint)
Converts a WorldPoint to the corresponding screen Y coordinate on the world map.
convertMapClickToWorldPoint(Client, int, int)static
public static WorldPoint convertMapClickToWorldPoint(Client client, int clickX, int clickY)Converts world map click coordinates to a WorldPoint.
This method handles the coordinate transformation from screen pixel coordinates on the world map widget to the corresponding world coordinates, taking into account map zoom level and current map position.
Parameters
client- The RuneLite client instance.
clickX- The x-coordinate of the mouse click on the screen.
clickY- The y-coordinate of the mouse click on the screen.
Returns
The corresponding WorldPoint, or null if the conversion fails (e.g., if the world map is not open or coordinates are invalid).
convertMapClickToWorldPoint(Client, int, int, int)static
public static WorldPoint convertMapClickToWorldPoint(Client client, int clickX, int clickY, int plane)Converts world map click coordinates to a WorldPoint with specific plane.
This is an overload of int, int) that allows specifying the plane/floor level for the resulting WorldPoint.
Parameters
client- The RuneLite client instance.
clickX- The x-coordinate of the mouse click on the screen.
clickY- The y-coordinate of the mouse click on the screen.
plane- The plane/floor level (0-3, where 0 is ground level).
Returns
The corresponding WorldPoint with the specified plane, or null if conversion fails.
drawGreenMapMarker(Graphics2D, WorldPoint)static
public static void drawGreenMapMarker(Graphics2D graphics, WorldPoint worldPoint)Convenience method to draw a standard-sized cyan marker.
Parameters
graphics- The Graphics2D context to draw on.
worldPoint- The world point where the marker should be positioned.
drawImageAtWorldPoint(Graphics2D, WorldPoint, BufferedImage, int, int, int, int)static
public static void drawImageAtWorldPoint(Graphics2D graphics, WorldPoint worldPoint, BufferedImage image, int width, int height, int offsetX, int offsetY)Draws a BufferedImage at a WorldPoint on the floating world map with customizable offset.
This method renders an image at the specified world coordinates with a configurable offset from the tile position. The offset allows precise positioning relative to the world point. The image will only be drawn if it falls within the visible map area and the world map is currently open.
Parameters
graphics- The Graphics2D context to draw on.
worldPoint- The world point to use as the reference position.
image- The BufferedImage to draw.
width- The desired width of the image in pixels.
height- The desired height of the image in pixels.
offsetX- The horizontal offset from the world point in pixels (negative = left, positive = right).
offsetY- The vertical offset from the world point in pixels (negative = up, positive = down).
drawImageAtWorldPointCentered(Graphics2D, WorldPoint, BufferedImage, int, int)static
public static void drawImageAtWorldPointCentered(Graphics2D graphics, WorldPoint worldPoint, BufferedImage image, int width, int height)Convenience method to draw a BufferedImage centered over a WorldPoint.
This is a helper method that automatically calculates the offset needed to center the image over the world point.
Parameters
graphics- The Graphics2D context to draw on.
worldPoint- The world point where the image should be centered.
image- The BufferedImage to draw.
width- The desired width of the image in pixels.
height- The desired height of the image in pixels.
drawMapMarker(Graphics2D, WorldPoint, Color, int)static
public static void drawMapMarker(Graphics2D graphics, WorldPoint worldPoint, Color color, int size)Draws a smooth, fluid teardrop/pin marker pointing to a WorldPoint on the floating world map.
This method renders a Google Maps-style marker with smooth curves using Bezier paths. The point is positioned exactly on the specified world coordinates.
Parameters
graphics- The Graphics2D context to draw on.
worldPoint- The world point where the marker point should be positioned.
color- The fill color of the marker.
size- The size of the marker (recommended: 20-40 for good visibility).
drawPath(Graphics2D, List<WorldPoint>, Color)static
public static void drawPath(Graphics2D graphics, List<WorldPoint> worldPoints, Color color)Draws a path of colored squares on the floating world map at the specified world points.
This method renders a series of colored squares at the given world coordinates on the world map interface. It ensures that the squares are only drawn within the visible map area and takes into account any UI elements that may obscure parts of the map.
Parameters
graphics- The Graphics2D context to draw on.
worldPoints- The list of WorldPoints where squares should be drawn.
color- The color of the squares to draw.
drawRedMapMarker(Graphics2D, WorldPoint)static
public static void drawRedMapMarker(Graphics2D graphics, WorldPoint worldPoint)Convenience method to draw a standard-sized red marker.
Parameters
graphics- The Graphics2D context to draw on.
worldPoint- The world point where the marker should be positioned.
isClickWithinMapBounds(Client, int, int)static
public static boolean isClickWithinMapBounds(Client client, int screenX, int screenY)Checks if the given screen coordinates are within the world map bounds.
Parameters
client- The RuneLite client instance.
screenX- The screen X coordinate to check.
screenY- The screen Y coordinate to check.
Returns
True if the coordinates are within the map bounds, false otherwise.
isWorldMapOpen(Client)static
public static boolean isWorldMapOpen(Client client)Checks if the world map is currently open and ready for coordinate conversion.
Parameters
client- The RuneLite client instance.
Returns
True if the world map is open and ready for use, false otherwise.
mapWorldPointToScreenX(Client, WorldPoint)static
public static Integer mapWorldPointToScreenX(Client client, WorldPoint worldPoint)Converts a WorldPoint to the corresponding screen X coordinate on the world map.
This is useful for drawing overlays or determining if a world point is visible on the current map view.
Parameters
client- The RuneLite client instance.
worldPoint- The world point to convert.
Returns
The screen X coordinate, or null if the conversion fails.
mapWorldPointToScreenY(Client, WorldPoint)static
public static Integer mapWorldPointToScreenY(Client client, WorldPoint worldPoint)Converts a WorldPoint to the corresponding screen Y coordinate on the world map.
This is useful for drawing overlays or determining if a world point is visible on the current map view.
Parameters
client- The RuneLite client instance.
worldPoint- The world point to convert.
Returns
The screen Y coordinate, or null if the conversion fails.
Also allowed
Every class has these, as in plain Java.
equals, toString