added basic BaritoneWalk

autowalk w/ baritone
This commit is contained in:
Dewy REDACTED 2020-04-17 14:02:27 +01:00
parent 1faa066873
commit fa86b65779
No known key found for this signature in database
GPG Key ID: 0CAA84A783228505
1 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,49 @@
package me.zeroeightsix.kami.module.modules.movement;
import baritone.api.BaritoneAPI;
import baritone.api.pathing.goals.GoalXZ;
import me.zeroeightsix.kami.module.Module;
import net.minecraft.util.math.MathHelper;
@Module.Info(name = "BaritoneWalk", description = "AutoWalk with Baritone pathfinding.", category = Module.Category.MOVEMENT)
public class BaritoneWalk extends Module {
private boolean walking = false;
@Override
public void onUpdate() {
// int facing = MathHelper.floor((double)(mc.player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
if (!walking) {
switch (mc.player.getHorizontalFacing()) {
case NORTH:
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX, (int) mc.player.posZ - 1068));
walking = true;
break;
case SOUTH:
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX, (int) mc.player.posZ + 1068));
walking = true;
break;
case EAST:
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX + 1068, (int) mc.player.posZ));
walking = true;
break;
case WEST:
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ((int) mc.player.posX - 1068, (int) mc.player.posZ));
walking = true;
break;
}
}
}
@Override
protected void onDisable() {
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoal(null);
walking = false;
}
}