Skip to content

Commit

Permalink
Add .locate command even if Baritone is not present but print an erro…
Browse files Browse the repository at this point in the history
…r if the structure requires Baritone to be located
  • Loading branch information
MineGame159 committed Oct 21, 2023
1 parent 6f7a2f2 commit 01ed966
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import meteordevelopment.meteorclient.commands.commands.*;
import meteordevelopment.meteorclient.pathing.BaritoneUtils;
import meteordevelopment.meteorclient.pathing.PathManagers;
import meteordevelopment.meteorclient.utils.PostInit;
import net.minecraft.client.network.ClientCommandSource;
Expand Down Expand Up @@ -62,10 +61,7 @@ public static void init() {
add(new RotationCommand());
add(new WaypointCommand());
add(new InputCommand());

if (BaritoneUtils.IS_AVAILABLE) {
add(new LocateCommand());
}
add(new LocateCommand());

COMMANDS.sort(Comparator.comparing(Command::getName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.commands.Command;
import meteordevelopment.meteorclient.events.packets.PacketEvent;
import meteordevelopment.meteorclient.pathing.BaritoneUtils;
import meteordevelopment.meteorclient.pathing.PathManagers;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.meteorclient.utils.player.InvUtils;
Expand Down Expand Up @@ -145,6 +146,11 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
}));

builder.then(literal("stronghold").executes(s -> {
if (!BaritoneUtils.IS_AVAILABLE) {
error("Locating this structure requires Baritone.");
return SINGLE_SUCCESS;
}

boolean foundEye = InvUtils.testInHotbar(Items.ENDER_EYE);

if (foundEye) {
Expand All @@ -170,6 +176,11 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
}));

builder.then(literal("nether_fortress").executes(s -> {
if (!BaritoneUtils.IS_AVAILABLE) {
error("Locating this structure requires Baritone.");
return SINGLE_SUCCESS;
}

Vec3d coords = findByBlockList(netherFortressBlocks);
if (coords == null) {
error("No nether fortress found.");
Expand All @@ -183,6 +194,11 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
}));

builder.then(literal("monument").executes(s -> {
if (!BaritoneUtils.IS_AVAILABLE) {
error("Locating this structure requires Baritone.");
return SINGLE_SUCCESS;
}

ItemStack stack = mc.player.getInventory().getMainHandStack();
if (stack.getItem() == Items.FILLED_MAP) {
NbtCompound tag = stack.getNbt();
Expand Down

0 comments on commit 01ed966

Please sign in to comment.