forked from RepoMirrors/kami-blue
close #281
This commit is contained in:
parent
435f3d4c29
commit
486c6ed88f
|
@ -31,11 +31,6 @@ public class OffhandGap extends Module {
|
|||
private Setting<Boolean> swordOrAxeOnly = register(Settings.b("Sword or Axe Only", true));
|
||||
private Setting<Boolean> preferBlocks = register(Settings.booleanBuilder("Prefer Placing Blocks").withValue(false).withVisibility(v -> !swordOrAxeOnly.getValue()).build());
|
||||
private Setting<Boolean> crystalCheck = register(Settings.b("Crystal Check", false));
|
||||
// private Setting<Mode> modeSetting = register(Settings.e("Use Mode", Mode.GAPPLE));
|
||||
|
||||
// private enum Mode {
|
||||
// GAPPLE, FOOD, CUSTOM
|
||||
// }
|
||||
|
||||
int gaps = -1;
|
||||
boolean autoTotemWasEnabled = false;
|
||||
|
@ -110,8 +105,6 @@ public class OffhandGap extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
// private static Map<Integer, ItemStack> getFullInventory() { return getInventorySlots(0, 45); }
|
||||
|
||||
/* If weaponCheck is disabled, check if they're not holding an item you'd want to use normally */
|
||||
private boolean passItemCheck() {
|
||||
if (swordOrAxeOnly.getValue()) return false;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.zeroeightsix.kami.module.modules.player;
|
||||
|
||||
import me.zeroeightsix.kami.command.Command;
|
||||
import me.zeroeightsix.kami.module.Module;
|
||||
import me.zeroeightsix.kami.setting.Setting;
|
||||
import me.zeroeightsix.kami.setting.Settings;
|
||||
|
@ -19,13 +20,17 @@ import net.minecraft.util.FoodStats;
|
|||
*/
|
||||
@Module.Info(name = "AutoEat", description = "Automatically eat when hungry", category = Module.Category.PLAYER)
|
||||
public class AutoEat extends Module {
|
||||
private Setting<Integer> foodLevel = register(Settings.integerBuilder("Eat level").withValue(15).withMinimum(1).withMaximum(20).build());
|
||||
|
||||
private Setting<Integer> foodLevel = register(Settings.integerBuilder("Below Hunger").withValue(15).withMinimum(1).withMaximum(20).build());
|
||||
private Setting<Integer> healthLevel = register(Settings.integerBuilder("Below Health").withValue(8).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 && (foodLevel.getValue()- food) >= ((ItemFood) stack.getItem()).getHealAmount(stack)) && passItemCheck(stack.getItem());
|
||||
return (
|
||||
(passItemCheck(stack.getItem()) && stack.getItem() instanceof ItemFood && (foodLevel.getValue() - food) >= ((ItemFood) stack.getItem()).getHealAmount(stack)) ||
|
||||
(passItemCheck(stack.getItem()) && stack.getItem() instanceof ItemFood && (healthLevel.getValue() - (mc.player.getHealth() + mc.player.getAbsorptionAmount()) > 0f))
|
||||
);
|
||||
}
|
||||
|
||||
private boolean passItemCheck(Item item) {
|
||||
|
@ -38,6 +43,7 @@ public class AutoEat extends Module {
|
|||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (mc.player == null) return;
|
||||
if (eating && !mc.player.isHandActive()) {
|
||||
if (lastSlot != -1) {
|
||||
mc.player.inventory.currentItem = lastSlot;
|
||||
|
|
Loading…
Reference in New Issue