Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoEat now toggle the InfiniteMine #4167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import meteordevelopment.meteorclient.systems.modules.combat.BedAura;
import meteordevelopment.meteorclient.systems.modules.combat.CrystalAura;
import meteordevelopment.meteorclient.systems.modules.combat.KillAura;
import meteordevelopment.meteorclient.systems.modules.world.InfinityMiner;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.meteorclient.utils.player.SlotUtils;
Expand All @@ -30,6 +31,8 @@

public class AutoEat extends Module {
private static final Class<? extends Module>[] AURAS = new Class[] { KillAura.class, CrystalAura.class, AnchorAura.class, BedAura.class };
//BARITONE related modules
private static final Class<? extends Module>[] BARITONE_MODULES = new Class[] { InfinityMiner.class };

private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final SettingGroup sgThreshold = settings.createGroup("Threshold");
Expand Down Expand Up @@ -100,7 +103,9 @@ public class AutoEat extends Module {
public boolean eating;
private int slot, prevSlot;

private final List<Class<? extends Module>> wasAura = new ArrayList<>();
private final List<Class<? extends Module>> wasAura = new ArrayList<>();
private final List<Class<? extends Module>> wasBaritoneList = new ArrayList<>();

private boolean wasBaritone = false;

public AutoEat() {
Expand Down Expand Up @@ -179,9 +184,19 @@ private void startEating() {
}

// Pause baritone
wasBaritoneList.clear();
if (pauseBaritone.get() && PathManagers.get().isPathing() && !wasBaritone) {
wasBaritone = true;
PathManagers.get().pause();
// pause baritone related modules (listed in BARITONE_MODULES)
for (Class<? extends Module> klass : BARITONE_MODULES) {
Module module = Modules.get().get(klass);

if (module.isActive()) {
wasBaritoneList.add(klass);
module.toggle();
}
}
}
}

Expand Down Expand Up @@ -209,11 +224,20 @@ private void stopEating() {
}
}
}


// Resume baritone
if (pauseBaritone.get() && wasBaritone) {
wasBaritone = false;
PathManagers.get().resume();
// Resume all paused baritone related modules (listed in BARITONE_MODULES)
for (Class<? extends Module> klass : BARITONE_MODULES) {
Module module = Modules.get().get(klass);

if (wasBaritoneList.contains(klass) && !module.isActive()) {
module.toggle();
}
}
}
}

Expand Down