Configurable colors for path rendering
This commit is contained in:
parent
c3a21b928e
commit
7b0f14a0e5
@ -22,8 +22,10 @@ import net.minecraft.init.Blocks;
|
|||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -396,6 +398,41 @@ public class Settings {
|
|||||||
*/
|
*/
|
||||||
public Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage);
|
public Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the current path
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorCurrentPath = new Setting<>(Color.RED);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the next path
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the blocks to break
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the blocks to place
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the blocks to walk into
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the best path so far
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The color of the path to the most recent considered node
|
||||||
|
*/
|
||||||
|
public Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN);
|
||||||
|
|
||||||
public final Map<String, Setting<?>> byLowerName;
|
public final Map<String, Setting<?>> byLowerName;
|
||||||
public final List<Setting<?>> allSettings;
|
public final List<Setting<?>> allSettings;
|
||||||
|
|
||||||
|
@ -398,27 +398,27 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
// Render the current path, if there is one
|
// Render the current path, if there is one
|
||||||
if (current != null && current.getPath() != null) {
|
if (current != null && current.getPath() != null) {
|
||||||
int renderBegin = Math.max(current.getPosition() - 3, 0);
|
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) {
|
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();
|
//long split = System.nanoTime();
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Color.RED);
|
PathRenderer.drawManySelectionBoxes(player(), current.toBreak(), partialTicks, Baritone.settings().colorBlocksToBreak.get());
|
||||||
PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Color.GREEN);
|
PathRenderer.drawManySelectionBoxes(player(), current.toPlace(), partialTicks, Baritone.settings().colorBlocksToPlace.get());
|
||||||
PathRenderer.drawManySelectionBoxes(player(), current.toWalkInto(), partialTicks, Color.MAGENTA);
|
PathRenderer.drawManySelectionBoxes(player(), current.toWalkInto(), partialTicks, Baritone.settings().colorBlocksToWalkInto.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a path calculation currently running, render the path calculation process
|
// If there is a path calculation currently running, render the path calculation process
|
||||||
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(currentlyRunning -> {
|
AbstractNodeCostSearch.getCurrentlyRunning().ifPresent(currentlyRunning -> {
|
||||||
currentlyRunning.bestPathSoFar().ifPresent(p -> {
|
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 -> {
|
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
||||||
|
|
||||||
PathRenderer.drawPath(mr, 0, player(), partialTicks, Color.CYAN, Baritone.settings().fadePath.get(), 10, 20);
|
PathRenderer.drawPath(mr, 0, player(), partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||||
PathRenderer.drawManySelectionBoxes(player(), Collections.singletonList(mr.getDest()), partialTicks, Color.CYAN);
|
PathRenderer.drawManySelectionBoxes(player(), Collections.singletonList(mr.getDest()), partialTicks, Baritone.settings().colorMostRecentConsidered.get());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user