diff --git a/README.md b/README.md
index 50de2a6d8..c09e3c1e6 100644
--- a/README.md
+++ b/README.md
@@ -13,11 +13,10 @@
![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.13.2-brightgreen.svg)](https://minecraft.gamepedia.com/1.13.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/)
@@ -32,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
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)
diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java
index 7847407b1..a0d6360cd 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);
@@ -91,6 +93,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.
*/
@@ -108,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);
@@ -431,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/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java
index d5a5a5f60..77b4e985c 100644
--- a/src/main/java/baritone/pathing/movement/MovementHelper.java
+++ b/src/main/java/baritone/pathing/movement/MovementHelper.java
@@ -300,6 +300,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(upState) ^ Baritone.settings().assumeWalkOnWater.value;
}
+ if (Baritone.settings().assumeWalkOnLava.value && isLava(state) && !isFlowing(x, y, z, state, bsi)) {
+ return true;
+ }
if (block == Blocks.GLASS || block instanceof BlockStainedGlass) {
return true;
}
diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java
index 725cdd4e1..2eb10425a 100644
--- a/src/main/java/baritone/process/BuilderProcess.java
+++ b/src/main/java/baritone/process/BuilderProcess.java
@@ -60,15 +60,16 @@ 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;
private Vec3i origin;
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.getInstance().gameDir, "schematics"), schematicFile);
@@ -81,6 +82,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
@@ -158,10 +164,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;
@@ -287,20 +293,16 @@ 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();
}
}
@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();
+ if (paused) {
+ return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
+ }
BuilderCalculationContext bcc = new BuilderCalculationContext();
if (!recalc(bcc)) {
logDirect("Done building");
@@ -377,9 +379,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);
@@ -435,10 +437,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()));
}
}
}
@@ -516,7 +516,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);
@@ -558,11 +558,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/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java
index 398dcff53..3444a3949 100644
--- a/src/main/java/baritone/process/MineProcess.java
+++ b/src/main/java/baritone/process/MineProcess.java
@@ -82,13 +82,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.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).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;
diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java
index 8f150e6c7..e77c5e7cf 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();
diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java
index c1b364050..60f9838f1 100644
--- a/src/main/java/baritone/utils/PathRenderer.java
+++ b/src/main/java/baritone/utils/PathRenderer.java
@@ -86,17 +86,22 @@ 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);
+ }
//drawManySelectionBoxes(player, Collections.singletonList(behavior.pathStart()), partialTicks, Color.WHITE);
//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);
@@ -107,11 +112,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 -> {