summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/anvil
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-12 18:04:56 +0100
committerGitHub <noreply@github.com>2024-03-12 18:04:56 +0100
commitb808a6aea1ba28ffd10712e7586b6f0d6cc1804a (patch)
tree1c4b9f8eacd97718b4042393a39c0ccbccf8dfa9 /src/main/java/at/hannibal2/skyhanni/features/anvil
parent9f1ba8207e8ae14da50058eeaaf0eb750b530dfa (diff)
downloadskyhanni-b808a6aea1ba28ffd10712e7586b6f0d6cc1804a.tar.gz
skyhanni-b808a6aea1ba28ffd10712e7586b6f0d6cc1804a.tar.bz2
skyhanni-b808a6aea1ba28ffd10712e7586b6f0d6cc1804a.zip
Internal Change: Code cleanup ContainerChest getAllItems (#1047)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/anvil')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt
index eddd232bd..9e9992ab1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt
@@ -3,6 +3,8 @@ package at.hannibal2.skyhanni.features.anvil
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.utils.InventoryUtils.getInventoryName
+import at.hannibal2.skyhanni.utils.InventoryUtils.getLowerItems
+import at.hannibal2.skyhanni.utils.InventoryUtils.getUpperItems
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -26,14 +28,9 @@ class AnvilCombineHelper {
val matchLore = mutableListOf<String>()
- for (slot in chest.inventorySlots) {
- if (slot == null) continue
-
- if (slot.slotNumber != slot.slotIndex) continue
- if (slot.stack == null) continue
-
+ for ((slot, stack) in chest.getUpperItems()) {
if (slot.slotNumber == 29) {
- val lore = slot.stack.getLore()
+ val lore = stack.getLore()
matchLore.addAll(lore)
break
}
@@ -41,16 +38,10 @@ class AnvilCombineHelper {
if (matchLore.isEmpty()) return
- for (slot in chest.inventorySlots) {
- if (slot == null) continue
-
- if (slot.slotNumber == slot.slotIndex) continue
- if (slot.stack == null) continue
-
-
- if (matchLore == slot.stack.getLore()) {
+ for ((slot, stack) in chest.getLowerItems()) {
+ if (matchLore == stack.getLore()) {
slot highlight LorenzColor.GREEN
}
}
}
-} \ No newline at end of file
+}