reset, fixes #84
This commit is contained in:
parent
a7abfef329
commit
36cbffb593
@ -187,6 +187,9 @@ public abstract class Movement implements Helper, MovementHelper {
|
||||
currentState.setStatus(MovementStatus.CANCELED);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
currentState = new MovementState().setStatus(MovementStatus.PREPPING);
|
||||
}
|
||||
|
||||
public double getTotalHardnessOfBlocksToBreak(CalculationContext ctx) {
|
||||
/*
|
||||
|
@ -64,6 +64,12 @@ public class MovementAscend extends Movement {
|
||||
// Counterpoint to the above TODO ^ you should move then pillar instead of ascend
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
ticksWithoutPlacement = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
IBlockState toPlace = BlockStateInterface.get(positionsToPlace[0]);
|
||||
|
@ -36,6 +36,12 @@ public class MovementDescend extends Movement {
|
||||
super(start, end, new BlockPos[]{end.up(2), end.up(), end}, new BlockPos[]{end.down()});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
numTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
if (!MovementHelper.canWalkOn(positionsToPlace[0])) {
|
||||
|
@ -36,6 +36,12 @@ public class MovementDownward extends Movement {
|
||||
super(start, end, new BlockPos[]{end}, new BlockPos[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
numTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
if (!MovementHelper.canWalkOn(dest.down())) {
|
||||
|
@ -38,6 +38,12 @@ public class MovementPillar extends Movement {
|
||||
super(start, end, new BlockPos[]{start.up(2)}, new BlockPos[]{start});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
numTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
Block fromDown = BlockStateInterface.get(src).getBlock();
|
||||
|
@ -66,6 +66,12 @@ public class MovementTraverse extends Movement {
|
||||
//note: do NOT add ability to place against .down().down()
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
wasTheBridgeBlockAlwaysThere = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calculateCost(CalculationContext context) {
|
||||
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
|
||||
|
@ -90,7 +90,11 @@ public class PathExecutor implements Helper {
|
||||
for (int i = 0; i < pathPosition - 2 && i < path.length(); i++) {//this happens for example when you lag out and get teleported back a couple blocks
|
||||
if (whereAmI.equals(path.positions().get(i))) {
|
||||
displayChatMessageRaw("Skipping back " + (pathPosition - i) + " steps, to " + i);
|
||||
int previousPos = pathPosition;
|
||||
pathPosition = Math.max(i - 1, 0); // previous step might not actually be done
|
||||
for (int j = pathPosition; j <= previousPos; j++) {
|
||||
path.movements().get(j).reset();
|
||||
}
|
||||
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user