single runaway goal object, allows splicing better

This commit is contained in:
Leijurv 2018-11-07 17:27:57 -08:00
parent 5b395ce3da
commit 7dc89b0190
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -56,6 +56,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
private List<Block> mining; private List<Block> mining;
private List<BlockPos> knownOreLocations; private List<BlockPos> knownOreLocations;
private BlockPos branchPoint; private BlockPos branchPoint;
private GoalRunAway branchPointRunaway;
private int desiredQuantity; private int desiredQuantity;
private int tickCount; private int tickCount;
@ -132,6 +133,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) { if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
// cool, path is over and we are at desired y // cool, path is over and we are at desired y
branchPoint = playerFeet(); branchPoint = playerFeet();
branchPointRunaway = null;
} else { } else {
return new GoalYLevel(y); return new GoalYLevel(y);
} }
@ -141,13 +143,16 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
// TODO mine 1x1 shafts to either side // TODO mine 1x1 shafts to either side
branchPoint = branchPoint.north(10); branchPoint = branchPoint.north(10);
}*/ }*/
return new GoalRunAway(1, Optional.of(y), branchPoint) { if (branchPointRunaway == null) {
branchPointRunaway = new GoalRunAway(1, Optional.of(y), branchPoint) {
@Override @Override
public boolean isInGoal(int x, int y, int z) { public boolean isInGoal(int x, int y, int z) {
return false; return false;
} }
}; };
} }
return branchPointRunaway;
}
private void rescan(List<BlockPos> already) { private void rescan(List<BlockPos> already) {
if (mining == null) { if (mining == null) {
@ -293,6 +298,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
this.desiredQuantity = quantity; this.desiredQuantity = quantity;
this.knownOreLocations = new ArrayList<>(); this.knownOreLocations = new ArrayList<>();
this.branchPoint = null; this.branchPoint = null;
this.branchPointRunaway = null;
rescan(new ArrayList<>()); rescan(new ArrayList<>());
} }
} }