From 7b0f14a0e5978cc9a5381517a82a3037a94db437 Mon Sep 17 00:00:00 2001 From: Brady Date: Sun, 23 Sep 2018 21:47:19 -0500 Subject: [PATCH] Configurable colors for path rendering --- src/api/java/baritone/api/Settings.java | 37 +++++++++++++++++++ .../baritone/behavior/PathingBehavior.java | 16 ++++---- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 6f0d668b..dd4867b6 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -22,8 +22,10 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.text.ITextComponent; +import java.awt.*; import java.lang.reflect.Field; import java.util.*; +import java.util.List; import java.util.function.Consumer; /** @@ -396,6 +398,41 @@ public class Settings { */ public Setting> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage); + /** + * The color of the current path + */ + public Setting colorCurrentPath = new Setting<>(Color.RED); + + /** + * The color of the next path + */ + public Setting colorNextPath = new Setting<>(Color.MAGENTA); + + /** + * The color of the blocks to break + */ + public Setting colorBlocksToBreak = new Setting<>(Color.RED); + + /** + * The color of the blocks to place + */ + public Setting colorBlocksToPlace = new Setting<>(Color.GREEN); + + /** + * The color of the blocks to walk into + */ + public Setting colorBlocksToWalkInto = new Setting<>(Color.MAGENTA); + + /** + * The color of the best path so far + */ + public Setting colorBestPathSoFar = new Setting<>(Color.BLUE); + + /** + * The color of the path to the most recent considered node + */ + public Setting colorMostRecentConsidered = new Setting<>(Color.CYAN); + public final Map> byLowerName; public final List> allSettings; diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 2d62a0f1..2ed2ffc5 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -398,27 +398,27 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior, // Render the current path, if there is one if (current != null && current.getPath() != null) { int renderBegin = Math.max(current.getPosition() - 3, 0); - PathRenderer.drawPath(current.getPath(), renderBegin, player(), partialTicks, Color.RED, Baritone.settings().fadePath.get(), 10, 20); + PathRenderer.drawPath(current.getPath(), renderBegin, player(), partialTicks, Baritone.settings().colorCurrentPath.get(), Baritone.settings().fadePath.get(), 10, 20); } if (next != null && next.getPath() != null) { - PathRenderer.drawPath(next.getPath(), 0, player(), partialTicks, Color.MAGENTA, Baritone.settings().fadePath.get(), 10, 20); + PathRenderer.drawPath(next.getPath(), 0, player(), partialTicks, Baritone.settings().colorNextPath.get(), Baritone.settings().fadePath.get(), 10, 20); } //long split = System.nanoTime(); if (current != null) { - PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Color.RED); - PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Color.GREEN); - PathRenderer.drawManySelectionBoxes(player(), current.toWalkInto(), partialTicks, Color.MAGENTA); + PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Baritone.settings().colorBlocksToBreak.get()); + PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Baritone.settings().colorBlocksToPlace.get()); + PathRenderer.drawManySelectionBoxes(player(), current.toWalkInto(), partialTicks, Baritone.settings().colorBlocksToWalkInto.get()); } // If there is a path calculation currently running, render the path calculation process AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(currentlyRunning -> { currentlyRunning.bestPathSoFar().ifPresent(p -> { - PathRenderer.drawPath(p, 0, player(), partialTicks, Color.BLUE, Baritone.settings().fadePath.get(), 10, 20); + PathRenderer.drawPath(p, 0, player(), partialTicks, Baritone.settings().colorBestPathSoFar.get(), Baritone.settings().fadePath.get(), 10, 20); currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> { - PathRenderer.drawPath(mr, 0, player(), partialTicks, Color.CYAN, Baritone.settings().fadePath.get(), 10, 20); - PathRenderer.drawManySelectionBoxes(player(), Collections.singletonList(mr.getDest()), partialTicks, Color.CYAN); + PathRenderer.drawPath(mr, 0, player(), partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20); + PathRenderer.drawManySelectionBoxes(player(), Collections.singletonList(mr.getDest()), partialTicks, Baritone.settings().colorMostRecentConsidered.get()); }); }); });