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 module conflict fix #4786

Open
wants to merge 2 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,9 @@
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.Nuker;
import meteordevelopment.meteorclient.systems.modules.world.InfinityMiner;
import meteordevelopment.meteorclient.systems.modules.player.AutoFish;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.meteorclient.utils.player.SlotUtils;
Expand All @@ -31,7 +34,7 @@
import java.util.function.BiPredicate;

public class AutoEat extends Module {
private static final Class<? extends Module>[] AURAS = new Class[]{KillAura.class, CrystalAura.class, AnchorAura.class, BedAura.class};
private static final Class<? extends Module>[] MODULELIST = new Class[]{KillAura.class, CrystalAura.class, AnchorAura.class, BedAura.class, Nuker.class, InfinityMiner.class, AutoFish.class};

private final SettingGroup sgGeneral = settings.getDefaultGroup();
private final SettingGroup sgThreshold = settings.createGroup("Threshold");
Expand All @@ -56,9 +59,9 @@ public class AutoEat extends Module {
.build()
);

private final Setting<Boolean> pauseAuras = sgGeneral.add(new BoolSetting.Builder()
.name("pause-auras")
.description("Pauses all auras when eating.")
private final Setting<Boolean> pauseModules = sgGeneral.add(new BoolSetting.Builder()
.name("pause-modules")
.description("Pauses all Auras, Nuker, InfinityMiner and AutoFish when eating.")
.defaultValue(true)
.build()
);
Expand Down Expand Up @@ -166,10 +169,10 @@ private void startEating() {
prevSlot = mc.player.getInventory().selectedSlot;
eat();

// Pause auras
// Pause Auras, Nuker, InfinityMiner and AutoFish
wasAura.clear();
if (pauseAuras.get()) {
for (Class<? extends Module> klass : AURAS) {
if (pauseModules.get()) {
for (Class<? extends Module> klass : MODULELIST) {
Module module = Modules.get().get(klass);

if (module.isActive()) {
Expand Down Expand Up @@ -200,9 +203,9 @@ private void stopEating() {

eating = false;

// Resume auras
if (pauseAuras.get()) {
for (Class<? extends Module> klass : AURAS) {
// Resume Auras, Nuker, InfinityMiner and AutoFish
if (pauseModules.get()) {
for (Class<? extends Module> klass : MODULELIST) {
Module module = Modules.get().get(klass);

if (wasAura.contains(klass) && !module.isActive()) {
Expand All @@ -228,7 +231,8 @@ private void changeSlot(int slot) {
}

public boolean shouldEat() {
boolean health = mc.player.getHealth() <= healthThreshold.get();
//The player should not try to eat when full even if the health is low.
boolean health = mc.player.getHealth() <= healthThreshold.get() && mc.player.getHungerManager().getFoodLevel() != 20;
boolean hunger = mc.player.getHungerManager().getFoodLevel() <= hungerThreshold.get();

return thresholdMode.get().test(health, hunger);
Expand Down
Loading