From 7dc89b019009a0ecc6848a364587c7cc83c3241a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 7 Nov 2018 17:27:57 -0800 Subject: [PATCH] single runaway goal object, allows splicing better --- .../java/baritone/process/MineProcess.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 48325dbb..1a2e9847 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -56,6 +56,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro private List mining; private List knownOreLocations; private BlockPos branchPoint; + private GoalRunAway branchPointRunaway; private int desiredQuantity; private int tickCount; @@ -132,6 +133,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) { // cool, path is over and we are at desired y branchPoint = playerFeet(); + branchPointRunaway = null; } else { return new GoalYLevel(y); } @@ -141,12 +143,15 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro // TODO mine 1x1 shafts to either side branchPoint = branchPoint.north(10); }*/ - return new GoalRunAway(1, Optional.of(y), branchPoint) { - @Override - public boolean isInGoal(int x, int y, int z) { - return false; - } - }; + if (branchPointRunaway == null) { + branchPointRunaway = new GoalRunAway(1, Optional.of(y), branchPoint) { + @Override + public boolean isInGoal(int x, int y, int z) { + return false; + } + }; + } + return branchPointRunaway; } private void rescan(List already) { @@ -293,6 +298,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro this.desiredQuantity = quantity; this.knownOreLocations = new ArrayList<>(); this.branchPoint = null; + this.branchPointRunaway = null; rescan(new ArrayList<>()); } }