Skip to content

Commit

Permalink
use baritone process for pausing
Browse files Browse the repository at this point in the history
  • Loading branch information
RacoonDog committed Oct 18, 2023
1 parent b3f82ab commit d9eb474
Showing 1 changed file with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.goals.GoalGetToBlock;
import baritone.api.pathing.goals.GoalXZ;
import baritone.api.process.IBaritoneProcess;
import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType;
import baritone.api.utils.Rotation;
import baritone.api.utils.SettingsUtil;
import meteordevelopment.meteorclient.MeteorClient;
Expand All @@ -31,6 +34,7 @@ public class BaritonePathManager implements IPathManager {
private final Settings settings;

private GoalDirection directionGoal;
private boolean pathingPaused;

public BaritonePathManager() {
// Subscribe to event bus
Expand All @@ -53,6 +57,9 @@ public BaritonePathManager() {

// Create settings
settings = new Settings();

// Baritone pathing control
BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(new MeteorBaritoneProcess());
}

@Override
Expand All @@ -62,12 +69,12 @@ public boolean isPathing() {

@Override
public void pause() {
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("pause");
pathingPaused = true;
}

@Override
public void resume() {
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("resume");
pathingPaused = false;
}

@Override
Expand Down Expand Up @@ -249,4 +256,36 @@ public int getZ() {
return this.z;
}
}

public class MeteorBaritoneProcess implements IBaritoneProcess {
@Override
public boolean isActive() {
return pathingPaused;
}

@Override
public PathingCommand onTick(boolean b, boolean b1) {
BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().clearAllKeys();
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
}

@Override
public boolean isTemporary() {
return true;
}

@Override
public void onLostControl() {
}

@Override
public double priority() {
return 0d;
}

@Override
public String displayName0() {
return "Meteor Client";
}
}
}

0 comments on commit d9eb474

Please sign in to comment.