aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-08-26 00:23:44 +0200
committerGitHub <noreply@github.com>2024-08-26 00:23:44 +0200
commitf1ad84c1976fc8f0aede4ec8c93f2ea289bffebd (patch)
treeda17fd8c813b6b06b0a51380d52acd0b0351f963 /src/main/java/at/hannibal2
parent6e5f9d154ed072ead75f5c44b9dd1988e94f88a6 (diff)
downloadskyhanni-f1ad84c1976fc8f0aede4ec8c93f2ea289bffebd.tar.gz
skyhanni-f1ad84c1976fc8f0aede4ec8c93f2ea289bffebd.tar.bz2
skyhanni-f1ad84c1976fc8f0aede4ec8c93f2ea289bffebd.zip
Fix: Pickup Log display not expiring in guis (#2401)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemPickupLog.kt36
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
+ }
}
}