This repository has been archived by the owner on Apr 22, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: fluffycq <[email protected]>
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
src/main/java/me/zeroeightsix/kami/module/modules/bewwawho/combat/Pull32k.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |