diff --git a/src/api/java/baritone/api/process/IBaritoneProcess.java b/src/api/java/baritone/api/process/IBaritoneProcess.java index 01e833c0..0339179c 100644 --- a/src/api/java/baritone/api/process/IBaritoneProcess.java +++ b/src/api/java/baritone/api/process/IBaritoneProcess.java @@ -35,6 +35,16 @@ import baritone.api.event.events.PathEvent; */ public interface IBaritoneProcess { + /** + * Default priority. Most normal processes should have this value. + *
+ * Some examples of processes that should have different values might include some kind of automated mob avoidance + * that would be temporary and would forcefully take control. Same for something that pauses pathing for auto eat, etc. + *
+ * The value is -1 beacuse that's what Impact 4.5's beta auto walk returns and I want to tie with it.
+ */
+ double DEFAULT_PRIORITY = -1;
+
/**
* Would this process like to be in control?
*
@@ -82,7 +92,9 @@ public interface IBaritoneProcess {
*
* @return A double representing the priority
*/
- double priority();
+ default double priority() {
+ return DEFAULT_PRIORITY;
+ }
/**
* Returns a user-friendly name for this process. Suitable for a HUD.
diff --git a/src/api/java/baritone/api/process/PathingCommand.java b/src/api/java/baritone/api/process/PathingCommand.java
index 2caef158..61445f8a 100644
--- a/src/api/java/baritone/api/process/PathingCommand.java
+++ b/src/api/java/baritone/api/process/PathingCommand.java
@@ -53,4 +53,9 @@ public class PathingCommand {
this.goal = goal;
this.commandType = commandType;
}
+
+ @Override
+ public String toString() {
+ return commandType + " " + goal;
+ }
}
diff --git a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java
index 3dc65990..d3ef9def 100644
--- a/src/main/java/baritone/pathing/movement/movements/MovementAscend.java
+++ b/src/main/java/baritone/pathing/movement/movements/MovementAscend.java
@@ -155,6 +155,10 @@ public class MovementAscend extends Movement {
return state.setStatus(MovementStatus.SUCCESS);
}
+ if (ctx.playerFeet().y < src.y) {
+ return state.setStatus(MovementStatus.UNREACHABLE);
+ }
+
IBlockState jumpingOnto = BlockStateInterface.get(ctx, positionToPlace);
if (!MovementHelper.canWalkOn(ctx, positionToPlace, jumpingOnto)) {
ticksWithoutPlacement++;
diff --git a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java
index 1bbfa6f9..e899ce63 100644
--- a/src/main/java/baritone/pathing/movement/movements/MovementPillar.java
+++ b/src/main/java/baritone/pathing/movement/movements/MovementPillar.java
@@ -148,6 +148,10 @@ public class MovementPillar extends Movement {
return state;
}
+ if (ctx.playerFeet().y < src.y) {
+ return state.setStatus(MovementStatus.UNREACHABLE);
+ }
+
IBlockState fromDown = BlockStateInterface.get(ctx, src);
if (MovementHelper.isWater(fromDown.getBlock()) && MovementHelper.isWater(ctx, dest)) {
// stay centered while swimming up a water column
diff --git a/src/main/java/baritone/process/CustomGoalProcess.java b/src/main/java/baritone/process/CustomGoalProcess.java
index a6234227..2c8a3c33 100644
--- a/src/main/java/baritone/process/CustomGoalProcess.java
+++ b/src/main/java/baritone/process/CustomGoalProcess.java
@@ -24,8 +24,6 @@ import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType;
import baritone.utils.BaritoneProcessHelper;
-import java.util.Objects;
-
/**
* As set by ExampleBaritoneControl or something idk
*
@@ -46,7 +44,7 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
private State state;
public CustomGoalProcess(Baritone baritone) {
- super(baritone, 3);
+ super(baritone);
}
@Override
@@ -79,20 +77,20 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
switch (this.state) {
case GOAL_SET:
- if (!baritone.getPathingBehavior().isPathing() && Objects.equals(baritone.getPathingBehavior().getGoal() + "", this.goal + "")) {
- this.state = State.NONE;
- }
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
case PATH_REQUESTED:
+ // return FORCE_REVALIDATE_GOAL_AND_PATH just once
PathingCommand ret = new PathingCommand(this.goal, PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH);
this.state = State.EXECUTING;
return ret;
case EXECUTING:
if (calcFailed) {
onLostControl();
+ return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
}
if (this.goal == null || this.goal.isInGoal(ctx.playerFeet())) {
onLostControl(); // we're there xd
+ return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
}
return new PathingCommand(this.goal, PathingCommandType.SET_GOAL_AND_PATH);
default:
diff --git a/src/main/java/baritone/process/ExploreProcess.java b/src/main/java/baritone/process/ExploreProcess.java
index 3f8d0f82..3343d882 100644
--- a/src/main/java/baritone/process/ExploreProcess.java
+++ b/src/main/java/baritone/process/ExploreProcess.java
@@ -31,7 +31,7 @@ public class ExploreProcess extends BaritoneProcessHelper {
private BlockPos explorationOrigin;
public ExploreProcess(Baritone baritone) {
- super(baritone, 0);
+ super(baritone);
}
@Override
diff --git a/src/main/java/baritone/process/FollowProcess.java b/src/main/java/baritone/process/FollowProcess.java
index 6e377dec..04e80e03 100644
--- a/src/main/java/baritone/process/FollowProcess.java
+++ b/src/main/java/baritone/process/FollowProcess.java
@@ -46,7 +46,7 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
private List