Search in sources :

Example 1 with GoalXZ

use of baritone.api.pathing.goals.GoalXZ in project baritone by cabaletta.

the class ExploreCommand method execute.

@Override
public void execute(String label, IArgConsumer args) throws CommandException {
    if (args.hasAny()) {
        args.requireExactly(2);
    } else {
        args.requireMax(0);
    }
    GoalXZ goal = args.hasAny() ? args.getDatatypePost(RelativeGoalXZ.INSTANCE, ctx.playerFeet()) : new GoalXZ(ctx.playerFeet());
    baritone.getExploreProcess().explore(goal.getX(), goal.getZ());
    logDirect(String.format("Exploring from %s", goal.toString()));
}
Also used : GoalXZ(baritone.api.pathing.goals.GoalXZ) RelativeGoalXZ(baritone.api.command.datatypes.RelativeGoalXZ)

Example 2 with GoalXZ

use of baritone.api.pathing.goals.GoalXZ in project baritone by cabaletta.

the class ThisWayCommand method execute.

@Override
public void execute(String label, IArgConsumer args) throws CommandException {
    args.requireExactly(1);
    GoalXZ goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYawHead, args.getAs(Double.class));
    baritone.getCustomGoalProcess().setGoal(goal);
    logDirect(String.format("Goal: %s", goal));
}
Also used : GoalXZ(baritone.api.pathing.goals.GoalXZ)

Example 3 with GoalXZ

use of baritone.api.pathing.goals.GoalXZ in project Spark-Client by Spark-Client-Development.

the class ThisWayCommand method execute.

@Override
public void execute(String label, IArgConsumer args) throws CommandException {
    args.requireExactly(1);
    GoalXZ goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYawHead, args.getAs(Double.class));
    baritone.getCustomGoalProcess().setGoal(goal);
    logDirect(String.format("Goal: %s", goal));
}
Also used : GoalXZ(baritone.api.pathing.goals.GoalXZ)

Example 4 with GoalXZ

use of baritone.api.pathing.goals.GoalXZ in project Spark-Client by Spark-Client-Development.

the class FollowProcess method towards.

private Goal towards(Entity following) {
    BlockPos pos;
    if (Baritone.settings().followOffsetDistance.getValue() == 0) {
        pos = new BlockPos(following);
    } else {
        GoalXZ g = GoalXZ.fromDirection(following.getPositionVector(), Baritone.settings().followOffsetDirection.getValue().floatValue(), Baritone.settings().followOffsetDistance.getValue());
        pos = new BlockPos(g.getX(), following.posY, g.getZ());
    }
    return new GoalNear(pos, Baritone.settings().followRadius.getValue());
}
Also used : GoalXZ(baritone.api.pathing.goals.GoalXZ) BlockPos(net.minecraft.util.math.BlockPos) GoalNear(baritone.api.pathing.goals.GoalNear)

Example 5 with GoalXZ

use of baritone.api.pathing.goals.GoalXZ in project meteor-client by MeteorDevelopment.

the class SwarmCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.then(literal("disconnect").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            swarm.close();
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("join").then(argument("ip", StringArgumentType.string()).then(argument("port", IntegerArgumentType.integer(0, 65535)).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (!swarm.isActive())
            swarm.toggle();
        swarm.close();
        swarm.mode.set(Swarm.Mode.Worker);
        swarm.worker = new SwarmWorker(StringArgumentType.getString(context, "ip"), IntegerArgumentType.getInteger(context, "port"));
        return SINGLE_SUCCESS;
    }))));
    builder.then(literal("connections").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                if (swarm.host.getConnectionCount() > 0) {
                    ChatUtils.info("--- Swarm Connections (highlight)(%s/%s)(default) ---", swarm.host.getConnectionCount(), swarm.host.getConnections().length);
                    for (int i = 0; i < swarm.host.getConnections().length; i++) {
                        SwarmConnection connection = swarm.host.getConnections()[i];
                        if (connection != null)
                            ChatUtils.info("(highlight)Worker %s(default): %s.", i, connection.getConnection());
                    }
                } else {
                    warning("No active connections");
                }
            } else if (swarm.isWorker()) {
                info("Connected to (highlight)%s", swarm.worker.getConnection());
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("follow").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput() + " " + mc.player.getEntityName());
            } else if (swarm.isWorker()) {
                error("The follow host command must be used by the host.");
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }).then(argument("player", PlayerArgumentType.player()).executes(context -> {
        PlayerEntity playerEntity = PlayerArgumentType.getPlayer(context);
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker() && playerEntity != null) {
                BaritoneAPI.getProvider().getPrimaryBaritone().getFollowProcess().follow(entity -> entity.getEntityName().equalsIgnoreCase(playerEntity.getEntityName()));
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("goto").then(argument("x", IntegerArgumentType.integer()).then(argument("z", IntegerArgumentType.integer()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                int x = IntegerArgumentType.getInteger(context, "x");
                int z = IntegerArgumentType.getInteger(context, "z");
                BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(x, z));
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }))));
    builder.then(literal("infinity-miner").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                runInfinityMiner();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }).then(argument("target", BlockStateArgumentType.blockState()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Modules.get().get(InfinityMiner.class).targetBlocks.set(List.of(context.getArgument("target", BlockStateArgument.class).getBlockState().getBlock()));
                runInfinityMiner();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }).then(argument("repair", BlockStateArgumentType.blockState()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Modules.get().get(InfinityMiner.class).targetBlocks.set(List.of(context.getArgument("target", BlockStateArgument.class).getBlockState().getBlock()));
                Modules.get().get(InfinityMiner.class).repairBlocks.set(List.of(context.getArgument("repair", BlockStateArgument.class).getBlockState().getBlock()));
                runInfinityMiner();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }))).then(literal("logout").then(argument("logout", BoolArgumentType.bool()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Modules.get().get(InfinityMiner.class).logOut.set(BoolArgumentType.getBool(context, "logout"));
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }))).then(literal("walkhome").then(argument("walkhome", BoolArgumentType.bool()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Modules.get().get(InfinityMiner.class).walkHome.set(BoolArgumentType.getBool(context, "walkhome"));
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }))));
    builder.then(literal("mine").then(argument("block", BlockStateArgumentType.blockState()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                swarm.worker.target = context.getArgument("block", BlockStateArgument.class).getBlockState().getBlock();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("toggle").then(argument("module", ModuleArgumentType.module()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Module module = ModuleArgumentType.getModule(context, "module");
                module.toggle();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }).then(literal("on").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Module m = ModuleArgumentType.getModule(context, "module");
                if (!m.isActive())
                    m.toggle();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    })).then(literal("off").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                Module m = ModuleArgumentType.getModule(context, "module");
                if (m.isActive())
                    m.toggle();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }))));
    builder.then(literal("scatter").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                scatter(100);
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }).then(argument("radius", IntegerArgumentType.integer()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                scatter(IntegerArgumentType.getInteger(context, "radius"));
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    })));
    builder.then(literal("stop").executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything();
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    }));
    builder.then(literal("exec").then(argument("command", StringArgumentType.greedyString()).executes(context -> {
        Swarm swarm = Modules.get().get(Swarm.class);
        if (swarm.isActive()) {
            if (swarm.isHost()) {
                swarm.host.sendMessage(context.getInput());
            } else if (swarm.isWorker()) {
                mc.player.sendChatMessage(StringArgumentType.getString(context, "command"));
            }
        } else {
            throw SWARM_NOT_ACTIVE.create();
        }
        return SINGLE_SUCCESS;
    })));
}
Also used : LiteralText(net.minecraft.text.LiteralText) PlayerArgumentType(meteordevelopment.meteorclient.systems.commands.arguments.PlayerArgumentType) Random(java.util.Random) SimpleCommandExceptionType(com.mojang.brigadier.exceptions.SimpleCommandExceptionType) ModuleArgumentType(meteordevelopment.meteorclient.systems.commands.arguments.ModuleArgumentType) SINGLE_SUCCESS(com.mojang.brigadier.Command.SINGLE_SUCCESS) BoolArgumentType(com.mojang.brigadier.arguments.BoolArgumentType) StringArgumentType(com.mojang.brigadier.arguments.StringArgumentType) GoalXZ(baritone.api.pathing.goals.GoalXZ) Command(meteordevelopment.meteorclient.systems.commands.Command) Module(meteordevelopment.meteorclient.systems.modules.Module) Modules(meteordevelopment.meteorclient.systems.modules.Modules) ChatUtils(meteordevelopment.meteorclient.utils.player.ChatUtils) BlockStateArgument(net.minecraft.command.argument.BlockStateArgument) BaritoneAPI(baritone.api.BaritoneAPI) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LiteralArgumentBuilder(com.mojang.brigadier.builder.LiteralArgumentBuilder) CommandSource(net.minecraft.command.CommandSource) BlockStateArgumentType(net.minecraft.command.argument.BlockStateArgumentType) Swarm(meteordevelopment.meteorclient.systems.modules.misc.swarm.Swarm) List(java.util.List) InfinityMiner(meteordevelopment.meteorclient.systems.modules.world.InfinityMiner) IntegerArgumentType(com.mojang.brigadier.arguments.IntegerArgumentType) SwarmConnection(meteordevelopment.meteorclient.systems.modules.misc.swarm.SwarmConnection) SwarmWorker(meteordevelopment.meteorclient.systems.modules.misc.swarm.SwarmWorker) Swarm(meteordevelopment.meteorclient.systems.modules.misc.swarm.Swarm) GoalXZ(baritone.api.pathing.goals.GoalXZ) SwarmConnection(meteordevelopment.meteorclient.systems.modules.misc.swarm.SwarmConnection) InfinityMiner(meteordevelopment.meteorclient.systems.modules.world.InfinityMiner) SwarmWorker(meteordevelopment.meteorclient.systems.modules.misc.swarm.SwarmWorker) Module(meteordevelopment.meteorclient.systems.modules.Module) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

GoalXZ (baritone.api.pathing.goals.GoalXZ)13 BlockPos (net.minecraft.util.math.BlockPos)5 Random (java.util.Random)4 BaritoneAPI (baritone.api.BaritoneAPI)2 RelativeGoalXZ (baritone.api.command.datatypes.RelativeGoalXZ)2 Goal (baritone.api.pathing.goals.Goal)2 GoalNear (baritone.api.pathing.goals.GoalNear)2 BetterBlockPos (baritone.api.utils.BetterBlockPos)2 IGoalRenderPos (baritone.api.utils.interfaces.IGoalRenderPos)2 AStarPathFinder (baritone.pathing.calc.AStarPathFinder)2 Favoring (baritone.utils.pathing.Favoring)2 SINGLE_SUCCESS (com.mojang.brigadier.Command.SINGLE_SUCCESS)2 BoolArgumentType (com.mojang.brigadier.arguments.BoolArgumentType)2 IntegerArgumentType (com.mojang.brigadier.arguments.IntegerArgumentType)2 StringArgumentType (com.mojang.brigadier.arguments.StringArgumentType)2 LiteralArgumentBuilder (com.mojang.brigadier.builder.LiteralArgumentBuilder)2 SimpleCommandExceptionType (com.mojang.brigadier.exceptions.SimpleCommandExceptionType)2 List (java.util.List)2 CommandSource (net.minecraft.command.CommandSource)2 BlockStateArgument (net.minecraft.command.argument.BlockStateArgument)2