diff --git a/src/main/java/baritone/behavior/MineBehavior.java b/src/main/java/baritone/behavior/MineBehavior.java index 311203e8..3bb5e8da 100644 --- a/src/main/java/baritone/behavior/MineBehavior.java +++ b/src/main/java/baritone/behavior/MineBehavior.java @@ -50,8 +50,8 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe public static final MineBehavior INSTANCE = new MineBehavior(); private List mining; - private List locationsCache; - private int quantity; + private List knownOreLocations; + private int desiredQuantity; private MineBehavior() {} @@ -64,11 +64,11 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe if (mining == null) { return; } - if (quantity > 0) { + if (desiredQuantity > 0) { Item item = mining.get(0).getItemDropped(mining.get(0).getDefaultState(), new Random(), 0); int curr = player().inventory.mainInventory.stream().filter(stack -> item.equals(stack.getItem())).mapToInt(ItemStack::getCount).sum(); System.out.println("Currently have " + curr + " " + item); - if (curr >= quantity) { + if (curr >= desiredQuantity) { logDirect("Have " + curr + " " + item.getItemStackDisplayName(new ItemStack(item, 1))); cancel(); return; @@ -88,12 +88,12 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe if (mining == null) { return; } - List locs = locationsCache; + List locs = knownOreLocations; if (!locs.isEmpty()) { locs = prune(new ArrayList<>(locs), mining, 64); PathingBehavior.INSTANCE.setGoal(coalesce(locs)); PathingBehavior.INSTANCE.path(); - locationsCache = locs; + knownOreLocations = locs; } } @@ -101,16 +101,16 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe if (mining == null) { return; } - List locs = scanFor(mining, 64); + List locs = xrayFor(mining, 64); if (locs.isEmpty()) { logDebug("No locations for " + mining + " known, cancelling"); mine(0, (String[]) null); return; } - locationsCache = locs; + knownOreLocations = locs; } - public Goal coalesce(BlockPos loc, List locs) { + private static Goal coalesce(BlockPos loc, List locs) { if (!Baritone.settings().forceInternalMining.get()) { return new GoalTwoBlocks(loc); } @@ -136,7 +136,7 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe return new GoalComposite(locs.stream().map(loc -> coalesce(loc, locs)).toArray(Goal[]::new)); } - public List scanFor(List mining, int max) { + public List xrayFor(List mining, int max) { List locs = new ArrayList<>(); List uninteresting = new ArrayList<>(); //long b = System.currentTimeMillis(); @@ -177,8 +177,8 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe @Override public void mine(int quantity, String... blocks) { this.mining = blocks == null || blocks.length == 0 ? null : Arrays.stream(blocks).map(ChunkPacker::stringToBlock).collect(Collectors.toList()); - this.quantity = quantity; - this.locationsCache = new ArrayList<>(); + this.desiredQuantity = quantity; + this.knownOreLocations = new ArrayList<>(); rescan(); updateGoal(); } @@ -186,8 +186,8 @@ public final class MineBehavior extends Behavior implements IMineBehavior, Helpe @Override public void mine(int quantity, Block... blocks) { this.mining = blocks == null || blocks.length == 0 ? null : Arrays.asList(blocks); - this.quantity = quantity; - this.locationsCache = new ArrayList<>(); + this.desiredQuantity = quantity; + this.knownOreLocations = new ArrayList<>(); rescan(); updateGoal(); } diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 4a73011f..77132e82 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -382,7 +382,7 @@ public class ExampleBaritoneControl extends Behavior implements Helper { return true; } } else { - List locs = MineBehavior.INSTANCE.scanFor(Collections.singletonList(block), 64); + List locs = MineBehavior.INSTANCE.xrayFor(Collections.singletonList(block), 64); if (locs.isEmpty()) { logDirect("No locations for " + mining + " known, cancelling"); return true;