diff --git a/src/main/java/shortestpath/PathTileOverlay.java b/src/main/java/shortestpath/PathTileOverlay.java index afafdcbb..3a6441c7 100644 --- a/src/main/java/shortestpath/PathTileOverlay.java +++ b/src/main/java/shortestpath/PathTileOverlay.java @@ -87,8 +87,9 @@ public Dimension render(Graphics2D graphics) { } if (config.drawTiles() && plugin.path != null) { + int i = 0; for (WorldPoint point : plugin.path) { - drawTile(graphics, point, new Color(255, 0, 0, 128)); + drawTile(graphics, point, ++i, new Color(255, 0, 0, 128)); } } @@ -116,7 +117,7 @@ private Point tileCenter(WorldPoint b) { return new Point(cx, cy); } - private void drawTile(Graphics2D graphics, WorldPoint point, Color color) { + private void drawTile(Graphics2D graphics, WorldPoint point, int i, Color color) { if (point.getPlane() != client.getPlane()) { return; } @@ -133,5 +134,13 @@ private void drawTile(Graphics2D graphics, WorldPoint point, Color color) { graphics.setColor(color); graphics.fill(poly); + + if (config.drawTileNumbers()) { + String s = "" + i; + graphics.setColor(Color.WHITE); + int stringX = (int) (poly.getBounds().getCenterX() - graphics.getFontMetrics().getStringBounds(s, graphics).getWidth() / 2); + int stringY = (int) poly.getBounds().getCenterY(); + graphics.drawString(s, stringX, stringY); + } } } diff --git a/src/main/java/shortestpath/ShortestPathConfig.java b/src/main/java/shortestpath/ShortestPathConfig.java index ae15ab9a..21a98834 100644 --- a/src/main/java/shortestpath/ShortestPathConfig.java +++ b/src/main/java/shortestpath/ShortestPathConfig.java @@ -12,6 +12,11 @@ default boolean drawTiles() { return true; } + @ConfigItem(keyName = "drawTileNumbers", name = "Draw tile numbers on tiles", description = "Whether the tile number should be drawn on the game tiles") + default boolean drawTileNumbers() { + return true; + } + @ConfigItem(keyName = "drawMinimap", name = "Draw path on minimap", description = "Whether the path should be drawn on the minimap") default boolean drawMinimap() { return true;