diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/player/AutoEat.java b/src/main/java/me/zeroeightsix/kami/module/modules/player/AutoEat.java index ef669a84..7dd3f764 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/player/AutoEat.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/player/AutoEat.java @@ -1,7 +1,11 @@ package me.zeroeightsix.kami.module.modules.player; import me.zeroeightsix.kami.module.Module; +import me.zeroeightsix.kami.setting.Setting; +import me.zeroeightsix.kami.setting.Settings; import net.minecraft.client.settings.KeyBinding; +import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumHand; @@ -9,17 +13,26 @@ import net.minecraft.util.FoodStats; /** * Created by 086 on 8/04/2018. + * Updated by polymer on 09/04/20 + * Updated by S-B99 on 09/04/20 */ @Module.Info(name = "AutoEat", description = "Automatically eat when hungry", category = Module.Category.PLAYER) public class AutoEat extends Module { - + private Setting foodLevel = register(Settings.integerBuilder("Eat level").withValue(15).withMinimum(1).withMaximum(20).build()); + private int lastSlot = -1; private boolean eating = false; private boolean isValid(ItemStack stack, int food) { - return stack.getItem() instanceof ItemFood && (20 - food) >= ((ItemFood) stack.getItem()).getHealAmount(stack); + return (stack.getItem() instanceof ItemFood && (foodLevel.getValue()- food) >= ((ItemFood) stack.getItem()).getHealAmount(stack)) && passItemCheck(stack.getItem()); } + private boolean passItemCheck(Item item) { + if (item == Items.ROTTEN_FLESH) return false; + if (item == Items.SPIDER_EYE) return false; + return true; + } + @Override public void onUpdate() { if (eating && !mc.player.isHandActive()) {