package Atheryx.client.module.impl.combat;
import Atheryx.client.event.EventHandler;
import Atheryx.client.event.list.player.UpdateEvent;
import Atheryx.client.module.Category;
import Atheryx.client.module.Module;
import Atheryx.client.module.ModuleInfo;
import Atheryx.client.module.setting.impl.SliderSetting;
import Atheryx.client.util.math.StopWatch;
import Atheryx.client.util.player.InvUtil;
import net.minecraft.item.Items;
import net.minecraft.screen.slot.SlotActionType;
@ModuleInfo(name = "AutoTotem", description = "Автоматически берет тотем в руки", category = Category.COMBAT)
public class AutoTotem extends Module {
private final StopWatch timer = new StopWatch();
private final SliderSetting healthLimit = new SliderSetting("Порог ХП", 6.0f, 0.5f, 20.0f, 0.5f);
public AutoTotem() {
addSetting(healthLimit);
}
@EventHandler
public void onUpdate(UpdateEvent event) {
if (mc.player == null || mc.interactionManager == null) return;
if (mc.player.getOffHandStack().getItem() == Items.TOTEM_OF_UNDYING) return;
if (mc.player.getHealth() > healthLimit.getFloat()) return;
int totemSlot = InvUtil.findHotbarItem(Items.TOTEM_OF_UNDYING);
if (totemSlot != -1 && timer.hasReached(150L)) {
int slotId = totemSlot + 36;
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, slotId, 0, SlotActionType.PICKUP, mc.player);
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, 45, 0, SlotActionType.PICKUP, mc.player);
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, slotId, 0, SlotActionType.PICKUP, mc.player);
timer.reset();
}
}
}