diff --git a/src/main/java/baritone/behavior/impl/MineBehavior.java b/src/main/java/baritone/behavior/impl/MineBehavior.java index 32f92877..f34aa480 100644 --- a/src/main/java/baritone/behavior/impl/MineBehavior.java +++ b/src/main/java/baritone/behavior/impl/MineBehavior.java @@ -29,6 +29,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.chunk.EmptyChunk; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -44,7 +45,7 @@ public class MineBehavior extends Behavior { private MineBehavior() { } - String mining; + List mining; @Override public void onTick(TickEvent event) { @@ -54,14 +55,17 @@ public class MineBehavior extends Behavior { if (mining == null) { return; } - List locs = new ArrayList<>(WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(mining, 1, 1)); + List locs = new ArrayList<>(); + for (String m : mining) { + locs.addAll(WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(m, 1, 1)); + } BlockPos playerFeet = playerFeet(); locs.sort(Comparator.comparingDouble(playerFeet::distanceSq)); // remove any that are within loaded chunks that aren't actually what we want locs.removeAll(locs.stream() .filter(pos -> !(world().getChunk(pos) instanceof EmptyChunk)) - .filter(pos -> !ChunkPacker.blockToString(BlockStateInterface.get(pos).getBlock()).equalsIgnoreCase(mining)) + .filter(pos -> !mining.contains(ChunkPacker.blockToString(BlockStateInterface.get(pos).getBlock()).toLowerCase())) .collect(Collectors.toList())); if (locs.size() > 30) { locs = locs.subList(0, 30); @@ -75,8 +79,8 @@ public class MineBehavior extends Behavior { PathingBehavior.INSTANCE.path(); } - public void mine(String mining) { - this.mining = mining; + public void mine(String... mining) { + this.mining = new ArrayList<>(Arrays.asList(mining)); } public void cancel() { diff --git a/src/main/java/baritone/utils/ExampleBaritoneControl.java b/src/main/java/baritone/utils/ExampleBaritoneControl.java index 75a36994..5bc75d3f 100644 --- a/src/main/java/baritone/utils/ExampleBaritoneControl.java +++ b/src/main/java/baritone/utils/ExampleBaritoneControl.java @@ -189,8 +189,8 @@ public class ExampleBaritoneControl extends Behavior { } if (msg.toLowerCase().startsWith("mine")) { String blockType = msg.toLowerCase().substring(4).trim(); - MineBehavior.INSTANCE.mine(blockType); - displayChatMessageRaw("Started mining blocks of type " + blockType); + MineBehavior.INSTANCE.mine(blockType.split(" ")); + displayChatMessageRaw("Started mining blocks of type " + Arrays.toString(blockType.split(" "))); event.cancel(); return; }