package fun.astral.modules.impl.misc;
import com.google.common.eventbus.Subscribe;
import fun.astral.events.EventUpdate;
import fun.astral.modules.api.Category;
import fun.astral.modules.api.Module;
import fun.astral.modules.api.ModuleRegister;
import net.minecraft.client.Minecraft;
import net.minecraft.inventory.container.ClickType;
// вместо ModuleRegister используй например FunctionRegister
// и в category = Category.Misc используй type = Category.Misc
@ModuleRegister(name = "AutoExpBottle", category = Category.Misc)
public class AutoExpBottle extends Module { // а тут вместо Module используй Function
private long lastActionTime = 0;
private int stage = 0;
@Subscribe
public void onUpdate(EventUpdate e) {
Minecraft mc = Minecraft.getInstance();
if (mc.player == null) return;
if (mc.player.experienceLevel >= 15) {
executeExpBottleCycle(mc);
}
}
private void executeExpBottleCycle(Minecraft mc) {
long currentTime = System.currentTimeMillis();
switch (stage) {
case 0:
mc.player.sendChatMessage("/exp");
stage++;
lastActionTime = currentTime;
break;
case 1:
if (currentTime - lastActionTime > 500 && isChestOpen()) {
takeSlot(23);
stage++;
lastActionTime = currentTime;
}
break;
case 2:
if (currentTime - lastActionTime > 500 && isChestOpen()) {
takeSlot(13);
stage++;
lastActionTime = currentTime;
}
break;
case 3:
if (currentTime - lastActionTime > 1000) {
stage = 0;
}
break;
}
}
private boolean isChestOpen() {
return true;
}
private void takeSlot(int slotId) {
Minecraft mc = Minecraft.getInstance();
if (mc.player != null && mc.player.openContainer != null) {
mc.playerController.windowClick(mc.player.openContainer.windowId, slotId, 0, ClickType.QUICK_MOVE, mc.player);
}
}
}