Search in sources :

Example 11 with GoalXZ

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

the class SwarmCommand method scatter.

private void scatter(int radius) {
    Random random = new Random();
    double a = random.nextDouble() * 2 * Math.PI;
    double r = radius * Math.sqrt(random.nextDouble());
    double x = mc.player.getX() + r * Math.cos(a);
    double z = mc.player.getZ() + r * Math.sin(a);
    BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything();
    BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) x, (int) z));
}
Also used : Random(java.util.Random) GoalXZ(baritone.api.pathing.goals.GoalXZ)

Example 12 with GoalXZ

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

the class FollowProcess method towards.

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

Example 13 with GoalXZ

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

the class PathingBehavior method createPathfinder.

private static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) {
    Goal transformed = goal;
    if (Baritone.settings().simplifyUnloadedYCoord.value && goal instanceof IGoalRenderPos) {
        BlockPos pos = ((IGoalRenderPos) goal).getGoalPos();
        if (!context.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ())) {
            transformed = new GoalXZ(pos.getX(), pos.getZ());
        }
    }
    Favoring favoring = new Favoring(context.getBaritone().getPlayerContext(), previous, context);
    return new AStarPathFinder(start.getX(), start.getY(), start.getZ(), transformed, favoring, context);
}
Also used : Goal(baritone.api.pathing.goals.Goal) GoalXZ(baritone.api.pathing.goals.GoalXZ) Favoring(baritone.utils.pathing.Favoring) IGoalRenderPos(baritone.api.utils.interfaces.IGoalRenderPos) BlockPos(net.minecraft.util.math.BlockPos) BetterBlockPos(baritone.api.utils.BetterBlockPos) AStarPathFinder(baritone.pathing.calc.AStarPathFinder)

Example 14 with GoalXZ

use of baritone.api.pathing.goals.GoalXZ in project Client by MatHax.

the class SwarmCommand method scatter.

private void scatter(int radius) {
    Random random = new Random();
    double a = random.nextDouble() * 2 * Math.PI;
    double r = radius * Math.sqrt(random.nextDouble());
    double x = mc.player.getX() + r * Math.cos(a);
    double z = mc.player.getZ() + r * Math.sin(a);
    BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything();
    BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) x, (int) z));
}
Also used : Random(java.util.Random) GoalXZ(baritone.api.pathing.goals.GoalXZ)

Aggregations

GoalXZ (baritone.api.pathing.goals.GoalXZ)14 BlockPos (net.minecraft.util.math.BlockPos)5 Random (java.util.Random)4 Goal (baritone.api.pathing.goals.Goal)3 BaritoneAPI (baritone.api.BaritoneAPI)2 RelativeGoalXZ (baritone.api.command.datatypes.RelativeGoalXZ)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