Compare commits

...

2 Commits

Author SHA1 Message Date
noil f5fabde095 Fix ModuleConfig bugs, config loading works great now 2023-05-19 14:11:37 -04:00
noil c89940160c AutoEat supports golden apples 2023-05-19 13:57:13 -04:00
2 changed files with 13 additions and 3 deletions

View File

@ -49,10 +49,16 @@ public class ModuleConfig extends Configurable {
}
// Check if we are already enabled
if (entry.getKey().equalsIgnoreCase("Enabled") && !module.isEnabled() && module.getType() != Module.ModuleType.HIDDEN) {
if (entry.getValue().getAsBoolean()) {
module.toggle();
if (entry.getKey().equalsIgnoreCase("Enabled") && module.getType() != Module.ModuleType.HIDDEN) {
if (entry.getValue().getAsBoolean() && !module.isEnabled()) {
module.setEnabled(true);
module.onEnable();
}
if (!entry.getValue().getAsBoolean() && module.isEnabled()) {
module.setEnabled(false);
module.onDisable();
}
module.onToggle();
}
for (Value val : module.getValueList()) {

View File

@ -19,6 +19,7 @@ public final class AutoEatModule extends Module {
public final Value<Float> hunger = new Value<Float>("Hunger", new String[]{"food", "h"}, "The amount of hunger needed to acquire some food", 9.0f, 0.0f, 20.0f, 0.5f);
public final Value<Integer> forcedSlot = new Value<Integer>("Slot", new String[]{"s"}, "The hot-bar slot to put the food into (45 for offhand)", 43, 0, 43, 1);
public final Value<Boolean> gapples = new Value<Boolean>("Gapples", new String[]{"gap", "gapple", "goldenapple", "goldenapples"}, "Allow eating golden apples for food", false);
private int previousHeldItem = -1;
private int foodSlot = -1;
@ -120,6 +121,9 @@ public final class AutoEatModule extends Module {
if (!(item instanceof ItemFood))
return false; // is not of ItemFood class
if (this.gapples.getValue())
return item == Items.GOLDEN_APPLE;
return item != Items.GOLDEN_APPLE && item != Items.CHORUS_FRUIT && item != Items.ROTTEN_FLESH && item != Items.POISONOUS_POTATO && item != Items.SPIDER_EYE;
}
}