From 6b6eea2d8c165dd976245f530b76228ab3973358 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 8 Apr 2019 20:32:47 -0800 Subject: [PATCH] add renderSelectionBoxes, fixes #378 --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/utils/PathRenderer.java | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 26b35f37..9793cf6b 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -438,6 +438,11 @@ public final class Settings { */ public final Setting renderGoal = new Setting<>(true); + /** + * Render selection boxes + */ + public final Setting renderSelectionBoxes = new Setting<>(true); + /** * Ignore depth when rendering the goal */ diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index 0c9a45f3..90fd2649 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -83,6 +83,14 @@ public final class PathRenderer implements Helper { if (goal != null && Baritone.settings().renderGoal.value) { drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.value); } + PathExecutor current = behavior.getCurrent(); // this should prevent most race conditions? + PathExecutor next = behavior.getNext(); // like, now it's not possible for current!=null to be true, then suddenly false because of another thread + + if (current != null && Baritone.settings().renderSelectionBoxes.value) { + drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.value); + drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.value); + drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.value); + } if (!Baritone.settings().renderPath.value) { return; } @@ -91,9 +99,6 @@ public final class PathRenderer implements Helper { //long start = System.nanoTime(); - PathExecutor current = behavior.getCurrent(); // this should prevent most race conditions? - PathExecutor next = behavior.getNext(); // like, now it's not possible for current!=null to be true, then suddenly false because of another thread - // Render the current path, if there is one if (current != null && current.getPath() != null) { int renderBegin = Math.max(current.getPosition() - 3, 0); @@ -104,11 +109,6 @@ public final class PathRenderer implements Helper { } //long split = System.nanoTime(); - if (current != null) { - drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.value); - drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.value); - drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.value); - } // If there is a path calculation currently running, render the path calculation process behavior.getInProgress().ifPresent(currentlyRunning -> {