Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/main/java/com/zenith/command/impl/PathfinderCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,39 @@ public LiteralArgumentBuilder<CommandContext> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/zenith/util/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -252,6 +253,16 @@ public static final class Pathfinder {
ItemRegistry.OAK_PLANKS.name()
});
public final Set<String> allowBreakAnyway = new ObjectArraySet<>();
public final Set<String> 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 {
Expand Down Expand Up @@ -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;
}

Expand Down
Loading