diff --git a/src/main/java/com/zenith/command/impl/PathfinderCommand.java b/src/main/java/com/zenith/command/impl/PathfinderCommand.java index 62c45425d..a284fe6cd 100644 --- a/src/main/java/com/zenith/command/impl/PathfinderCommand.java +++ b/src/main/java/com/zenith/command/impl/PathfinderCommand.java @@ -919,6 +919,39 @@ public LiteralArgumentBuilder register() { .description("Acceptable Throwaway Items Cleared") .primaryColor(); }))) + .then(literal("blocksToAvoidBreaking") + .then(literal("list").executes(c -> { + CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.removeIf(blockName -> BlockRegistry.REGISTRY.get(blockName) == null); + c.getSource().getEmbed() + .title("Pathfinder") + .description(String.join("\n", CONFIG.client.extra.pathfinder.blocksToAvoidBreaking)) + .primaryColor(); + })) + .then(literal("add").then(argument("block", block()).executes(c -> { + var block = getBlock(c, "block"); + CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.add(block.name()); + CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.removeIf(blockName -> BlockRegistry.REGISTRY.get(blockName) == null); + c.getSource().getEmbed() + .title("Pathfinder") + .description(String.join("\n", CONFIG.client.extra.pathfinder.blocksToAvoidBreaking)) + .primaryColor(); + }))) + .then(literal("del").then(argument("block", block()).executes(c -> { + var block = getBlock(c, "block"); + CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.remove(block.name()); + CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.removeIf(blockName -> BlockRegistry.REGISTRY.get(blockName) == null); + c.getSource().getEmbed() + .title("Pathfinder") + .description(String.join("\n", CONFIG.client.extra.pathfinder.blocksToAvoidBreaking)) + .primaryColor(); + }))) + .then(literal("clear").executes(c -> { + CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.clear(); + c.getSource().getEmbed() + .title("Pathfinder") + .description("Blocks To Avoid Breaking Cleared") + .primaryColor(); + }))) .then(literal("allowBreakAnyway") .then(literal("list").executes(c -> { CONFIG.client.extra.pathfinder.allowBreakAnyway.removeIf(blockName -> BlockRegistry.REGISTRY.get(blockName) == null); diff --git a/src/main/java/com/zenith/feature/pathfinder/movement/MovementHelper.java b/src/main/java/com/zenith/feature/pathfinder/movement/MovementHelper.java index 649b2d5e9..f0b3082b3 100644 --- a/src/main/java/com/zenith/feature/pathfinder/movement/MovementHelper.java +++ b/src/main/java/com/zenith/feature/pathfinder/movement/MovementHelper.java @@ -34,16 +34,14 @@ public static boolean avoidBreaking(int x, int y, int z, int state) { // return true; // } Block b = BlockStateInterface.getBlock(state); - return // Baritone.settings().blocksToDisallowBreaking.value.contains(b) || - b == BlockRegistry.ICE // ice becomes water, and water can mess up the path - || b.name().startsWith("infested_") // b instanceof InfestedBlock // obvious reasons - // call context.get directly with x,y,z. no need to make 5 new BlockPos for no reason - || avoidAdjacentBreaking(x, y + 1, z, true, false) - || avoidAdjacentBreaking(x, y - 1, z, false, true) - || avoidAdjacentBreaking(x + 1, y, z, false, false) - || avoidAdjacentBreaking(x - 1, y, z, false, false) - || avoidAdjacentBreaking(x, y, z + 1, false, false) - || avoidAdjacentBreaking(x, y, z - 1, false, false); + return CONFIG.client.extra.pathfinder.blocksToAvoidBreaking.contains(b.name()) + // call context.get directly with x,y,z. no need to make 5 new BlockPos for no reason + || avoidAdjacentBreaking(x, y + 1, z, true, false) + || avoidAdjacentBreaking(x, y - 1, z, false, true) + || avoidAdjacentBreaking(x + 1, y, z, false, false) + || avoidAdjacentBreaking(x - 1, y, z, false, false) + || avoidAdjacentBreaking(x, y, z + 1, false, false) + || avoidAdjacentBreaking(x, y, z - 1, false, false); } public static boolean avoidAdjacentBreaking(int x, int y, int z, boolean directlyAbove, boolean directlyBelow) { diff --git a/src/main/java/com/zenith/util/config/Config.java b/src/main/java/com/zenith/util/config/Config.java index 75cdb495c..df0541cda 100644 --- a/src/main/java/com/zenith/util/config/Config.java +++ b/src/main/java/com/zenith/util/config/Config.java @@ -6,6 +6,7 @@ import com.zenith.feature.tasks.Task; import com.zenith.feature.waypoints.Waypoint; import com.zenith.feature.whitelist.PlayerEntry; +import com.zenith.mc.block.BlockRegistry; import com.zenith.mc.item.ItemRegistry; import com.zenith.module.impl.ActiveHours.ActiveTime; import it.unimi.dsi.fastutil.ints.IntArraySet; @@ -252,6 +253,16 @@ public static final class Pathfinder { ItemRegistry.OAK_PLANKS.name() }); public final Set allowBreakAnyway = new ObjectArraySet<>(); + public final Set blocksToAvoidBreaking = new ObjectArraySet<>(new String[]{ + BlockRegistry.ICE.name(), + BlockRegistry.INFESTED_STONE.name(), + BlockRegistry.INFESTED_COBBLESTONE.name(), + BlockRegistry.INFESTED_STONE_BRICKS.name(), + BlockRegistry.INFESTED_MOSSY_STONE_BRICKS.name(), + BlockRegistry.INFESTED_CRACKED_STONE_BRICKS.name(), + BlockRegistry.INFESTED_CHISELED_STONE_BRICKS.name(), + BlockRegistry.INFESTED_DEEPSLATE.name() + }); } public static class SessionTimeLimit { @@ -854,7 +865,7 @@ public String getProxyAddress() { if (!this.proxyIP.contains(":") && (this.proxyIP.matches("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+") || this.proxyIP.startsWith("localhost"))) // IP address return this.proxyIP + ":" + this.bind.port; - else + else return this.proxyIP; }