Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
add pull32k (#367)
Browse files Browse the repository at this point in the history
Co-authored-by: fluffycq <[email protected]>
  • Loading branch information
5HT2 and fluffycq authored Jan 12, 2020
1 parent 8790cc1 commit 2636f3d
Showing 1 changed file with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package me.zeroeightsix.kami.module.modules.bewwawho.combat;

import me.zeroeightsix.kami.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Enchantments;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.ContainerHopper;
import net.minecraft.item.ItemAir;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CPacketHeldItemChange;

@Module.Info(name = "Pull32k", category = Module.Category.COMBAT)
public class Pull32k extends Module{
boolean foundsword = false;
@Override
public void onUpdate() {
boolean foundair = false;
int enchantedSwordIndex = -1;
for (int i = 0; i < 9; i++) {
ItemStack itemStack = mc.player.inventory.mainInventory.get(i);
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SHARPNESS, itemStack) >= Short.MAX_VALUE) {
enchantedSwordIndex = i;
foundsword = true;
}
if(!foundsword) {
enchantedSwordIndex = -1;
foundsword = false;
}
}
if (enchantedSwordIndex != -1) {
if (mc.player.inventory.currentItem != enchantedSwordIndex) {
mc.player.connection.sendPacket(new CPacketHeldItemChange(enchantedSwordIndex));
mc.player.inventory.currentItem = enchantedSwordIndex;
mc.playerController.updateController();
}
}
if (enchantedSwordIndex == -1 && mc.player.openContainer != null && mc.player.openContainer instanceof ContainerHopper && mc.player.openContainer.inventorySlots != null && !mc.player.openContainer.inventorySlots.isEmpty()) {
for (int i = 0; i < 5; i++) {
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SHARPNESS, mc.player.openContainer.inventorySlots.get(0).inventory.getStackInSlot(i)) >= Short.MAX_VALUE) {
enchantedSwordIndex = i;
break;
}
}

if (enchantedSwordIndex == -1) {
return;
}
if(enchantedSwordIndex != -1) {
for (int i = 0; i < 9; i++) {
ItemStack itemStack = mc.player.inventory.mainInventory.get(i);
if (itemStack.getItem() instanceof ItemAir) {
if (mc.player.inventory.currentItem != i) {
mc.player.connection.sendPacket(new CPacketHeldItemChange(i));
mc.player.inventory.currentItem = i;
mc.playerController.updateController();
}
foundair = true;
break;
}
}
}
if (foundair || checkStuff()) {
mc.playerController.windowClick(mc.player.openContainer.windowId, enchantedSwordIndex, mc.player.inventory.currentItem, ClickType.SWAP, mc.player);
}
}
}
public boolean checkStuff() {
if(EnchantmentHelper.getEnchantmentLevel(Enchantments.SHARPNESS, mc.player.inventory.getCurrentItem()) == Short.valueOf((short)5)) {
return true;
} else {
return false;
}
}
}

0 comments on commit 2636f3d

Please sign in to comment.