From 71491a792285070a5a606ba6669b5030494f9549 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 23 Mar 2019 22:17:40 -0800 Subject: [PATCH 01/20] blank space --- .../baritone/pathing/movement/movements/MovementAscend.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java index b7b7eb5f4..2ba10f706 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java @@ -197,9 +197,7 @@ public class MovementAscend extends Movement { if (headBonkClear()) { return state.setInput(Input.JUMP, true); } - - - // System.out.println(flatDistToNext + " " + sideDist); + if (flatDistToNext > 1.2 || sideDist > 0.2) { return state; } From a8f373d56851addbafe9d31fa4a7fc50166ccacd Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 24 Mar 2019 13:07:08 -0700 Subject: [PATCH 02/20] fine; assumewalkonlava --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/pathing/movement/MovementHelper.java | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index b2d89fd87..1e34371e2 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -91,6 +91,11 @@ public final class Settings { */ public final Setting assumeWalkOnWater = new Setting<>(false); + /** + * If you have Fire Resistance and Jesus then I guess you could turn this on lol + */ + public final Setting assumeWalkOnLava = new Setting<>(false); + /** * Assume step functionality; don't jump on an Ascend. */ diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 12ab8e72f..aeac6bcb9 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -290,6 +290,9 @@ public interface MovementHelper extends ActionCosts, Helper { // if assumeWalkOnWater is off, we can only walk on water if there is water above it return isWater(up) ^ Baritone.settings().assumeWalkOnWater.value; } + if (Baritone.settings().assumeWalkOnLava.value && isLava(block)) { + return true; + } if (block == Blocks.GLASS || block == Blocks.STAINED_GLASS) { return true; } From 27e39c80831ec037595e73a961cb50a59aa94f0d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 24 Mar 2019 13:50:50 -0700 Subject: [PATCH 03/20] update badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f498951c5..6baca457d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ [![Minecraft](https://img.shields.io/badge/MC-1.12.2-green.svg)](https://minecraft.gamepedia.com/1.12.2) [![GitHub contributors](https://img.shields.io/github/contributors/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/graphs/contributors/) [![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/) -[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.3-brightgreen.svg)](https://impactdevelopment.github.io/) +[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.5%20/%20v1.3.0-brightgreen.svg)](https://impactdevelopment.github.io/) [![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/) [![KAMI integration](https://img.shields.io/badge/KAMI%20integration-v1.0.0-red.svg)](https://github.com/zeroeightysix/KAMI/) [![Future integration](https://img.shields.io/badge/Future%20integration-Soonβ„’%3F%3F%3F-red.svg)](https://futureclient.net/) From 2e8fdd43ee9a72bc23b748dd74161404f7a8f9bd Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 24 Mar 2019 13:53:19 -0700 Subject: [PATCH 04/20] no flowing --- src/main/java/baritone/pathing/movement/MovementHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index aeac6bcb9..447e4f088 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -290,7 +290,7 @@ public interface MovementHelper extends ActionCosts, Helper { // if assumeWalkOnWater is off, we can only walk on water if there is water above it return isWater(up) ^ Baritone.settings().assumeWalkOnWater.value; } - if (Baritone.settings().assumeWalkOnLava.value && isLava(block)) { + if (Baritone.settings().assumeWalkOnLava.value && isLava(block) && !isFlowing(x, y, z, state, bsi)) { return true; } if (block == Blocks.GLASS || block == Blocks.STAINED_GLASS) { From 9fcae6560e350e91c7d2178fcd24b22477be1f57 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 25 Mar 2019 21:03:19 -0800 Subject: [PATCH 05/20] better feature branch example --- SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SETUP.md b/SETUP.md index 49ab838f7..1767e2c5b 100644 --- a/SETUP.md +++ b/SETUP.md @@ -1,7 +1,7 @@ # Installation ## Prebuilt official releases -These releases are not always completely up to date with latest features, and are only released from `master`. (so if you want `builder` branch for example, you'll have to build it yourself) +These releases are not always completely up to date with latest features, and are only released from `master`. (so if you want `backfill-2` branch for example, you'll have to build it yourself) Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases) From d2de8828e7340452e1fa60913946e23ec8fdb695 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 26 Mar 2019 23:01:07 -0700 Subject: [PATCH 06/20] did this --- src/main/java/baritone/process/BuilderProcess.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 9dd6fc922..320d6030e 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -275,13 +275,6 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro @Override public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { - // TODO somehow tell inventorybehavior what we'd like to have on the hotbar - // perhaps take the 16 closest positions in incorrectPositions to ctx.playerFeet that aren't desired to be air, and then snag the top 4 most common block states, then request those on the hotbar - - - // this will work as is, but it'll be trashy - // need to iterate over incorrectPositions and see which ones we can "correct" from our current standing position - baritone.getInputOverrideHandler().clearAllKeys(); BuilderCalculationContext bcc = new BuilderCalculationContext(); if (!recalc(bcc)) { From 926e2d56201a03705c8ee5e047580b22d27f5468 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 27 Mar 2019 17:32:02 -0700 Subject: [PATCH 07/20] add resuming to builder, fixes #371 --- .../java/baritone/process/BuilderProcess.java | 18 ++++++++++++++---- .../baritone/utils/ExampleBaritoneControl.java | 5 +++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 320d6030e..8b2263abd 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -65,6 +65,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro private ISchematic schematic; private Vec3i origin; private int ticks; + private boolean paused; public boolean build(String schematicFile, BlockPos origin) { File file = new File(new File(Minecraft.getMinecraft().gameDir, "schematics"), schematicFile); @@ -77,6 +78,11 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro this.name = name; this.schematic = schematic; this.origin = origin; + this.paused = false; + } + + public void resume() { + paused = false; } @Override @@ -276,6 +282,9 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro @Override public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { baritone.getInputOverrideHandler().clearAllKeys(); + if (paused) { + return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); + } BuilderCalculationContext bcc = new BuilderCalculationContext(); if (!recalc(bcc)) { logDirect("Done building"); @@ -352,9 +361,9 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro if (goal == null) { goal = assemble(bcc, approxPlacable); // we're far away, so assume that we have our whole inventory to recalculate placable properly if (goal == null) { - logDirect("Unable to do it =("); - onLostControl(); - return null; + logDirect("Unable to do it. Pausing. resume to resume, cancel to cancel"); + paused = true; + return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); } } return new PathingCommandContext(goal, PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH, bcc); @@ -533,11 +542,12 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro incorrectPositions = null; name = null; schematic = null; + paused = false; } @Override public String displayName0() { - return "Building " + name; + return paused ? "Builder Paused" : "Building " + name; } public List placable(int size) { diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 6dbdf388f..9b8dd4880 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -353,6 +353,11 @@ public class ExampleBaritoneControl extends Behavior implements Helper { baritone.getBuilderProcess().clearArea(corner1, corner2); return true; } + if (msg.equals("resume")) { + baritone.getBuilderProcess().resume(); + logDirect("resumed"); + return true; + } if (msg.equals("reset")) { for (Settings.Setting setting : Baritone.settings().allSettings) { setting.reset(); From 3329db1dae08d0e709133fbfc89ac21f8c6ed7ba Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 28 Mar 2019 23:01:14 -0700 Subject: [PATCH 08/20] these show the exact same info; remove one --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 6baca457d..ea03c4065 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ ![Code size](https://img.shields.io/github/languages/code-size/cabaletta/baritone.svg) ![GitHub repo size](https://img.shields.io/github/repo-size/cabaletta/baritone.svg) ![](https://tokei.rs/b1/github/cabaletta/baritone?category=code) -![](https://tokei.rs/b1/github/cabaletta/baritone?category=files) [![Minecraft](https://img.shields.io/badge/MC-1.12.2-green.svg)](https://minecraft.gamepedia.com/1.12.2) [![GitHub contributors](https://img.shields.io/github/contributors/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/graphs/contributors/) [![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/) From 71482cc9847e99e568d95889c93feb29d80a86b6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 29 Mar 2019 23:10:19 -0700 Subject: [PATCH 09/20] explain for brainlets --- src/api/java/baritone/api/Settings.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 1e34371e2..c671b0fa5 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -58,7 +58,9 @@ public final class Settings { /** * It doesn't actually take twenty ticks to place a block, this cost is so high - * because we want to generally conserve blocks which might be limited + * because we want to generally conserve blocks which might be limited. + *

+ * Decrease to make Baritone more often consider paths that would require placing blocks */ public final Setting blockPlacementPenalty = new Setting<>(20D); From 2c3dc5d6b181ffd817ed116353d1073b434616b9 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 30 Mar 2019 23:23:12 -0700 Subject: [PATCH 10/20] add plea --- src/api/java/baritone/api/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index c671b0fa5..26b35f370 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -115,7 +115,7 @@ public final class Settings { /** * If true, parkour is allowed to make jumps when standing on blocks at the maximum height, so player feet is y=256 *

- * Defaults to false because this fails on constantiam + * Defaults to false because this fails on constantiam. Please let me know if this is ever disabled. Please. */ public final Setting allowJumpAt256 = new Setting<>(false); From af11e64cec40e2fc4ef0de11817fc61d14514164 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 31 Mar 2019 20:22:17 -0800 Subject: [PATCH 11/20] combine nested --- src/main/java/baritone/process/BuilderProcess.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 8b2263abd..852d239db 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -419,10 +419,8 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro for (int y = 0; y < schematic.heightY(); y++) { for (int z = 0; z < schematic.lengthZ(); z++) { for (int x = 0; x < schematic.widthX(); x++) { - if (schematic.inSchematic(x, y, z)) { - if (!valid(bcc.bsi.get0(x + origin.getX(), y + origin.getY(), z + origin.getZ()), schematic.desiredState(x, y, z))) { - incorrectPositions.add(new BetterBlockPos(x + origin.getX(), y + origin.getY(), z + origin.getZ())); - } + if (schematic.inSchematic(x, y, z) && !valid(bcc.bsi.get0(x + origin.getX(), y + origin.getY(), z + origin.getZ()), schematic.desiredState(x, y, z))) { + incorrectPositions.add(new BetterBlockPos(x + origin.getX(), y + origin.getY(), z + origin.getZ())); } } } From ccc3de2d7c96f04fcce667b3441fb396c6551bf6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 1 Apr 2019 23:30:33 -0700 Subject: [PATCH 12/20] dawn of the 8th month --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea03c4065..e016fa946 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Baritone is the pathfinding system used in [Impact](https://impactdevelopment.gi This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths). -Have committed at least once a day for the last 7 months =D πŸ¦€ +Have committed at least once a day for the last 8 months =D πŸ¦€ 1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2 From 71a2219b073fe8a01559dbd609e30b94e690021a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 2 Apr 2019 21:40:33 -0800 Subject: [PATCH 13/20] move fields to the top --- src/main/java/baritone/process/BuilderProcess.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 852d239db..0dabc6979 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -55,11 +55,7 @@ import java.util.stream.Collectors; import static baritone.api.pathing.movement.ActionCosts.COST_INF; public class BuilderProcess extends BaritoneProcessHelper implements IBuilderProcess { - - public BuilderProcess(Baritone baritone) { - super(baritone); - } - + private HashSet incorrectPositions; private String name; private ISchematic schematic; @@ -67,6 +63,10 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro private int ticks; private boolean paused; + public BuilderProcess(Baritone baritone) { + super(baritone); + } + public boolean build(String schematicFile, BlockPos origin) { File file = new File(new File(Minecraft.getMinecraft().gameDir, "schematics"), schematicFile); System.out.println(file + " " + file.exists()); From 75b54dfaecaa9d9bd6b26a20739f22cceab44fc1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 3 Apr 2019 23:19:32 -0700 Subject: [PATCH 14/20] nullpointer is confusing --- src/main/java/baritone/process/BuilderProcess.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 0dabc6979..b0daf22d2 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -55,7 +55,7 @@ import java.util.stream.Collectors; import static baritone.api.pathing.movement.ActionCosts.COST_INF; public class BuilderProcess extends BaritoneProcessHelper implements IBuilderProcess { - + private HashSet incorrectPositions; private String name; private ISchematic schematic; @@ -275,7 +275,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro double z = side.getZOffset() == 0 ? 0.5 : (1 + side.getZOffset()) / 2D; return new Vec3d[]{new Vec3d(x, 0.25, z), new Vec3d(x, 0.75, z)}; default: // null - throw new NullPointerException(); + throw new IllegalStateException(); } } From bf076f62464e0863b83bb2d4b7e492362ce79e45 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 4 Apr 2019 20:51:02 -0800 Subject: [PATCH 15/20] privatize --- src/main/java/baritone/process/BuilderProcess.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index b0daf22d2..93c6734e7 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -160,10 +160,10 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro } public class Placement { - final int hotbarSelection; - final BlockPos placeAgainst; - final EnumFacing side; - final Rotation rot; + private final int hotbarSelection; + private final BlockPos placeAgainst; + private final EnumFacing side; + private final Rotation rot; public Placement(int hotbarSelection, BlockPos placeAgainst, EnumFacing side, Rotation rot) { this.hotbarSelection = hotbarSelection; From 87a9e67ba8956aed76eb48509141cb767d0c5af9 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 5 Apr 2019 11:59:28 -0700 Subject: [PATCH 16/20] dont reassign arg --- src/main/java/baritone/process/MineProcess.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index f2ebcd552..ff8d68ba2 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -81,13 +81,14 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro return null; } } + boolean shouldCancel = calcFailed; if (calcFailed && !knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance..."); knownOreLocations.stream().sorted(Comparator.comparingDouble(ctx.player()::getDistanceSq)).findFirst().ifPresent(blacklist::add); knownOreLocations.removeIf(blacklist::contains); - calcFailed = false; // 😎 + shouldCancel = false; // 😎 } - if (calcFailed) { + if (shouldCancel) { logDirect("Unable to find any path to " + mining + ", canceling Mine"); cancel(); return null; From 867c01ff86588be6105c89d38647a948af2e7f34 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 6 Apr 2019 21:50:22 -0800 Subject: [PATCH 17/20] crucial performance optimization --- src/main/java/baritone/process/MineProcess.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index ff8d68ba2..07e47b91c 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -84,7 +84,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro boolean shouldCancel = calcFailed; if (calcFailed && !knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance..."); - knownOreLocations.stream().sorted(Comparator.comparingDouble(ctx.player()::getDistanceSq)).findFirst().ifPresent(blacklist::add); + knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add); knownOreLocations.removeIf(blacklist::contains); shouldCancel = false; // 😎 } From e54652941b9879301d6cb3769ddcbbe8947520bb Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 7 Apr 2019 17:44:23 -0700 Subject: [PATCH 18/20] codacy --- src/main/java/baritone/process/BuilderProcess.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 93c6734e7..56115b49a 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -498,7 +498,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro } public static class GoalAdjacent extends GoalGetToBlock { - boolean allowSameLevel; + private boolean allowSameLevel; public GoalAdjacent(BlockPos pos, boolean allowSameLevel) { super(pos); From 6b6eea2d8c165dd976245f530b76228ab3973358 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 8 Apr 2019 20:32:47 -0800 Subject: [PATCH 19/20] 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 26b35f370..9793cf6bd 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 0c9a45f34..90fd26499 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 -> { From fc3f183dce44ad8755061b94107d55143475b87b Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 9 Apr 2019 08:45:30 -0700 Subject: [PATCH 20/20] actually don't render the boxes if renderpath is false --- src/main/java/baritone/utils/PathRenderer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index 90fd26499..e4fd58b11 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -83,17 +83,17 @@ public final class PathRenderer implements Helper { if (goal != null && Baritone.settings().renderGoal.value) { drawDankLitGoalBox(renderView, goal, partialTicks, Baritone.settings().colorGoalBox.value); } + + if (!Baritone.settings().renderPath.value) { + return; + } 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; - } //drawManySelectionBoxes(player, Collections.singletonList(behavior.pathStart()), partialTicks, Color.WHITE); //long start = System.nanoTime();