@@ -0,0 +1,2427 @@
+/*%0A * Copyright  2014 - 2017 %7C Wurst-Imperium %7C All rights reserved.%0A *%0A * This Source Code Form is subject to the terms of the Mozilla Public%0A * License, v. 2.0. If a copy of the MPL was not distributed with this%0A * file, You can obtain one at http://mozilla.org/MPL/2.0/.%0A */%0Apackage net.wurstclient.utils;%0A%0Aimport net.minecraft.init.Items;%0Aimport net.minecraft.item.Item;%0Aimport net.minecraft.item.ItemArmor;%0Aimport net.minecraft.item.ItemStack;%0Aimport net.minecraft.network.play.client.CPacketCreativeInventoryAction;%0Aimport net.minecraft.potion.Potion;%0Aimport net.minecraft.potion.PotionEffect;%0Aimport net.minecraft.potion.PotionUtils;%0Aimport net.minecraft.util.math.BlockPos;%0Aimport net.wurstclient.compatibility.WBlock;%0Aimport net.wurstclient.compatibility.WConnection;%0Aimport net.wurstclient.compatibility.WMinecraft;%0A%0Apublic class InventoryUtils%0A%7B%0A%09public static boolean placeStackInHotbar(ItemStack stack)%0A%09%7B%0A%09%09for(int i = 0; i %3C 9; i++)%0A%09%09%09if(isSlotEmpty(i))%0A%09%09%09%7B%0A%09%09%09%09WConnection.sendPacket(%0A%09%09%09%09%09new CPacketCreativeInventoryAction(36 + i, stack));%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%0A%09%09return false;%0A%09%7D%0A%09%0A%09public static void placeStackInArmor(int armorSlot, ItemStack stack)%0A%09%7B%0A%09%09WMinecraft.getPlayer().inventory.armorInventory%5BarmorSlot%5D = stack;%0A%09%7D%0A%09%0A%09public static boolean isSlotEmpty(int slot)%0A%09%7B%0A%09%09return WMinecraft.getPlayer().inventory.getStackInSlot(slot) == null;%0A%09%7D%0A%09%0A%09public static boolean isEmptySlot(ItemStack slot)%0A%09%7B%0A%09%09return slot == null;%0A%09%7D%0A%09%0A%09public static boolean isSplashPotion(ItemStack stack)%0A%09%7B%0A%09%09return stack.getItem() == Items.SPLASH_POTION;%0A%09%7D%0A%09%0A%09public static ItemStack createSplashPotion()%0A%09%7B%0A%09%09return new ItemStack(Items.SPLASH_POTION);%0A%09%7D%0A%09%0A%09public static int getArmorType(ItemArmor armor)%0A%09%7B%0A%09%09return armor.armorType.ordinal() - 2;%0A%09%7D%0A%09%0A%09public static float getStrVsBlock(ItemStack stack, BlockPos pos)%0A%09%7B%0A%09%09return stack.getStrVsBlock(WBlock.getState(pos));%0A%09%7D%0A%09%0A%09public static boolean hasEffect(ItemStack stack, Potion potion)%0A%09%7B%0A%09%09for(PotionEffect effect : PotionUtils.getEffectsFromStack(stack))%0A%09%09%09if(effect.getPotion() == potion)%0A%09%09%09%09return true;%0A%09%09%09%0A%09%09return false;%0A%09%7D%0A%09%0A%09public static boolean checkHeldItem(ItemValidator validator)%0A%09%7B%0A%09%09ItemStack stack = WMinecraft.getPlayer().inventory.getCurrentItem();%0A%09%09%0A%09%09if(isEmptySlot(stack))%0A%09%09%09return false;%0A%09%09%0A%09%09return validator.isValid(stack.getItem());%0A%09%7D%0A%09%0A%09public static interface ItemValidator%0A%09%7B%0A%09%09public boolean isValid(Item item);%0A%09%7D%0A%7D%0A

Add InventoryUtils