aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-09-24 10:27:50 +0200
committerGitHub <noreply@github.com>2024-09-24 10:27:50 +0200
commit1e9764d1d1209177d4a939a9b812931a7d49a926 (patch)
treeb903d47fb7f4f23db60211a29419a06863982dd5 /src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
parent04d2530a67ef9ae2b877a448e15ce16fadd4c25b (diff)
downloadskyhanni-1e9764d1d1209177d4a939a9b812931a7d49a926.tar.gz
skyhanni-1e9764d1d1209177d4a939a9b812931a7d49a926.tar.bz2
skyhanni-1e9764d1d1209177d4a939a9b812931a7d49a926.zip
Backend: PrimitiveIngredient changes and code cleanup (#2576)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 198b43a85..2f17ea4d1 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -9,10 +9,12 @@ import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.isInt
+import at.hannibal2.skyhanni.utils.PrimitiveIngredient.Companion.toPrimitiveItemStacks
import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getItemId
import at.hannibal2.skyhanni.utils.json.BaseGsonBuilder
@@ -308,8 +310,8 @@ object NEUItems {
if (!recipe.isCraftingRecipe()) continue
val map = mutableMapOf<NEUInternalName, Int>()
- for (ingredient in recipe.getCachedIngredients()) {
- val count = ingredient.count.toInt()
+ for (ingredient in recipe.getCachedIngredients().toPrimitiveItemStacks()) {
+ val amount = ingredient.amount
var internalItemId = ingredient.internalName
// ignore cactus green
if (internalName == "ENCHANTED_CACTUS_GREEN".asInternalName() && internalItemId == "INK_SACK-2".asInternalName()) {
@@ -331,8 +333,7 @@ object NEUItems {
continue
}
- val old = map.getOrDefault(internalItemId, 0)
- map[internalItemId] = old + count
+ map.addOrPut(internalItemId, amount)
}
if (map.size != 1) continue
val current = map.iterator().next().toPair()