diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-03-12 18:04:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 18:04:56 +0100 |
commit | b808a6aea1ba28ffd10712e7586b6f0d6cc1804a (patch) | |
tree | 1c4b9f8eacd97718b4042393a39c0ccbccf8dfa9 /src/main/java/at/hannibal2/skyhanni/features/garden | |
parent | 9f1ba8207e8ae14da50058eeaaf0eb750b530dfa (diff) | |
download | skyhanni-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/garden')
2 files changed, 4 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index 8ab53cb9c..c8eebc10a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.InventoryUtils.getUpperItems import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor @@ -83,11 +84,7 @@ class GardenComposterInventoryFeatures { val guiChest = event.gui val chest = guiChest.inventorySlots as ContainerChest - for (slot in chest.inventorySlots) { - if (slot == null) continue - if (slot.slotNumber != slot.slotIndex) continue - val stack = slot.stack ?: continue - + for ((slot, stack) in chest.getUpperItems()) { if (stack.getLore().any { it == "§eClick to upgrade!" }) { slot highlight LorenzColor.GOLD } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index f7576abba..c361c1888 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -8,6 +8,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.InventoryUtils.getUpperItems import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzColor @@ -85,10 +86,7 @@ class JacobFarmingContestsInventory { val guiChest = event.gui val chest = guiChest.inventorySlots as ContainerChest - for (slot in chest.inventorySlots) { - if (slot == null) continue - if (slot.slotNumber != slot.slotIndex) continue - val stack = slot.stack ?: continue + for ((slot, stack) in chest.getUpperItems()) { if (stack.getLore().any { it == "§eClick to claim reward!" }) { slot highlight LorenzColor.GREEN } |