diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt index 55473a2c6..05aaeba80 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt @@ -136,32 +136,32 @@ object ItemPickupLog { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - if (InventoryUtils.inInventory()) return - val oldItemList = mutableMapOf<Int, Pair<ItemStack, Int>>() oldItemList.putAll(itemList) - itemList.clear() + if (!InventoryUtils.inInventory()) { + itemList.clear() - val inventoryItems = InventoryUtils.getItemsInOwnInventory().toMutableList() - val cursorItem = Minecraft.getMinecraft().thePlayer.inventory?.itemStack + val inventoryItems = InventoryUtils.getItemsInOwnInventory().toMutableList() + val cursorItem = Minecraft.getMinecraft().thePlayer.inventory?.itemStack - if (cursorItem != null) { - val hash = cursorItem.hash() - //this prevents items inside hypixel guis counting when picked up - if (oldItemList.contains(hash)) { - inventoryItems.add(cursorItem) + if (cursorItem != null) { + val hash = cursorItem.hash() + //this prevents items inside hypixel guis counting when picked up + if (oldItemList.contains(hash)) { + inventoryItems.add(cursorItem) + } } - } - for (itemStack in inventoryItems) { - val hash = itemStack.hash() - val old = itemList[hash] - if (old != null) { - itemList[hash] = old.copy(second = old.second + itemStack.stackSize) - } else { - itemList[hash] = itemStack to itemStack.stackSize + for (itemStack in inventoryItems) { + val hash = itemStack.hash() + val old = itemList[hash] + if (old != null) { + itemList[hash] = old.copy(second = old.second + itemStack.stackSize) + } else { + itemList[hash] = itemStack to itemStack.stackSize + } } } |