From d9eb4744fff0d9ce2817d07adcfd77145798ab27 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:06:57 -0400 Subject: [PATCH 1/2] use baritone process for pausing --- .../pathing/BaritonePathManager.java | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java b/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java index 9921245d38..d42f619165 100644 --- a/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java +++ b/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java @@ -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; @@ -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 @@ -53,6 +57,9 @@ public BaritonePathManager() { // Create settings settings = new Settings(); + + // Baritone pathing control + BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(new MeteorBaritoneProcess()); } @Override @@ -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 @@ -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"; + } + } } From 7e30d5e9e5f6988c10ec342b929a1b5630cb1940 Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Wed, 18 Oct 2023 22:23:58 +0200 Subject: [PATCH 2/2] Update name and visibility --- .../meteorclient/pathing/BaritonePathManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java b/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java index d42f619165..420cc2ecd3 100644 --- a/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java +++ b/src/main/java/meteordevelopment/meteorclient/pathing/BaritonePathManager.java @@ -59,7 +59,7 @@ public BaritonePathManager() { settings = new Settings(); // Baritone pathing control - BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(new MeteorBaritoneProcess()); + BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().registerProcess(new BaritoneProcess()); } @Override @@ -257,7 +257,7 @@ public int getZ() { } } - public class MeteorBaritoneProcess implements IBaritoneProcess { + private class BaritoneProcess implements IBaritoneProcess { @Override public boolean isActive() { return pathingPaused;