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);
|
currentState.setStatus(MovementStatus.CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
currentState = new MovementState().setStatus(MovementStatus.PREPPING);
|
||||||
|
}
|
||||||
|
|
||||||
public double getTotalHardnessOfBlocksToBreak(CalculationContext ctx) {
|
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
|
// Counterpoint to the above TODO ^ you should move then pillar instead of ascend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
ticksWithoutPlacement = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calculateCost(CalculationContext context) {
|
protected double calculateCost(CalculationContext context) {
|
||||||
IBlockState toPlace = BlockStateInterface.get(positionsToPlace[0]);
|
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()});
|
super(start, end, new BlockPos[]{end.up(2), end.up(), end}, new BlockPos[]{end.down()});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
numTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calculateCost(CalculationContext context) {
|
protected double calculateCost(CalculationContext context) {
|
||||||
if (!MovementHelper.canWalkOn(positionsToPlace[0])) {
|
if (!MovementHelper.canWalkOn(positionsToPlace[0])) {
|
||||||
|
@ -36,6 +36,12 @@ public class MovementDownward extends Movement {
|
|||||||
super(start, end, new BlockPos[]{end}, new BlockPos[0]);
|
super(start, end, new BlockPos[]{end}, new BlockPos[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
numTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calculateCost(CalculationContext context) {
|
protected double calculateCost(CalculationContext context) {
|
||||||
if (!MovementHelper.canWalkOn(dest.down())) {
|
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});
|
super(start, end, new BlockPos[]{start.up(2)}, new BlockPos[]{start});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
numTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calculateCost(CalculationContext context) {
|
protected double calculateCost(CalculationContext context) {
|
||||||
Block fromDown = BlockStateInterface.get(src).getBlock();
|
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()
|
//note: do NOT add ability to place against .down().down()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
super.reset();
|
||||||
|
wasTheBridgeBlockAlwaysThere = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calculateCost(CalculationContext context) {
|
protected double calculateCost(CalculationContext context) {
|
||||||
IBlockState pb0 = BlockStateInterface.get(positionsToBreak[0]);
|
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
|
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))) {
|
if (whereAmI.equals(path.positions().get(i))) {
|
||||||
displayChatMessageRaw("Skipping back " + (pathPosition - i) + " steps, to " + 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
|
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();
|
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user