autototem

This commit is contained in:
zeroeightsix 2018-10-14 02:31:09 +02:00
parent 49e62d896d
commit 0ce4b063e5
1 changed files with 24 additions and 21 deletions

View File

@ -1,7 +1,8 @@
package me.zeroeightsix.kami.module.modules.combat;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.ISetting;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.init.Items;
import net.minecraft.inventory.ClickType;
@ -16,26 +17,26 @@ public class AutoTotem extends Module {
int totems;
boolean moving = false;
boolean returnI = false;
@ISetting(name = "Soft")
private boolean soft = true;
private Setting<Boolean> soft = Settings.b("Soft");
@Override
public void onUpdate() {
if (mc.currentScreen instanceof GuiContainer) return;
if (returnI) {
int t = -1;
for (int i = 0; i < 45; i++) if (mc.player.inventory.getStackInSlot(i).isEmpty) {
t = i;
break;
}
for (int i = 0; i < 45; i++)
if (mc.player.inventory.getStackInSlot(i).isEmpty) {
t = i;
break;
}
if (t == -1) return;
mc.playerController.windowClick(0, t<9 ? t+36 : t, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, t < 9 ? t + 36 : t, 0, ClickType.PICKUP, mc.player);
returnI = false;
}
totems = mc.player.inventory.mainInventory.stream().filter(itemStack -> itemStack.getItem() == Items.TOTEM_OF_UNDYING).mapToInt(ItemStack::getCount).sum();
if (mc.player.getHeldItemOffhand().getItem() == Items.TOTEM_OF_UNDYING) totems++;
else{
if (soft && !mc.player.getHeldItemOffhand().isEmpty) return;
else {
if (soft.getValue() && !mc.player.getHeldItemOffhand().isEmpty) return;
if (moving) {
mc.playerController.windowClick(0, 45, 0, ClickType.PICKUP, mc.player);
moving = false;
@ -45,21 +46,23 @@ public class AutoTotem extends Module {
if (mc.player.inventory.itemStack.isEmpty()) {
if (totems == 0) return;
int t = -1;
for (int i = 0; i < 45; i++) if (mc.player.inventory.getStackInSlot(i).getItem() == Items.TOTEM_OF_UNDYING) {
t = i;
break;
}
for (int i = 0; i < 45; i++)
if (mc.player.inventory.getStackInSlot(i).getItem() == Items.TOTEM_OF_UNDYING) {
t = i;
break;
}
if (t == -1) return; // Should never happen!
mc.playerController.windowClick(0, t<9 ? t+36 : t, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, t < 9 ? t + 36 : t, 0, ClickType.PICKUP, mc.player);
moving = true;
}else if (!soft) {
} else if (!soft.getValue()) {
int t = -1;
for (int i = 0; i < 45; i++) if (mc.player.inventory.getStackInSlot(i).isEmpty) {
t = i;
break;
}
for (int i = 0; i < 45; i++)
if (mc.player.inventory.getStackInSlot(i).isEmpty) {
t = i;
break;
}
if (t == -1) return;
mc.playerController.windowClick(0, t<9 ? t+36 : t, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, t < 9 ? t + 36 : t, 0, ClickType.PICKUP, mc.player);
}
}
}