aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-04-27 11:42:45 +0200
committerGitHub <noreply@github.com>2024-04-27 11:42:45 +0200
commit772d5ae117e27663f8089844596119ae4d0ba543 (patch)
treea7e131095520c2bacaeaf98549435070e885048d /src/main
parentfbd57ff44b308e649a83593ed8b686c56cdcba4d (diff)
downloadskyhanni-772d5ae117e27663f8089844596119ae4d0ba543.tar.gz
skyhanni-772d5ae117e27663f8089844596119ae4d0ba543.tar.bz2
skyhanni-772d5ae117e27663f8089844596119ae4d0ba543.zip
Fix: Visitor Supercraft (#1550)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
index ba5706f1d..33643a172 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.itemName
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.NEUItems.allIngredients
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
@@ -71,8 +72,8 @@ class GardenVisitorSupercraft {
private fun getSupercraftForSacks(internalName: NEUInternalName, amount: Int) {
val ingredients = NEUItems.getRecipes(internalName)
// TODO describe what this line does
- .first { !it.ingredients.first().internalItemId.contains("PEST") }
- .ingredients
+ .firstOrNull() { !it.allIngredients().first().internalItemId.contains("PEST") }
+ ?.allIngredients() ?: return
val ingredientReqs = mutableMapOf<String, Int>()
for (ingredient in ingredients) {
val key = ingredient.internalItemId
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index f379ea2f2..0324efcbb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -322,7 +322,7 @@ object NEUItems {
}
}
- fun NeuRecipe.getCachedIngredients() = ingredientsCache.getOrPut(this) { ingredients }
+ fun NeuRecipe.getCachedIngredients() = ingredientsCache.getOrPut(this) { allIngredients() }
fun neuHasFocus(): Boolean {
if (AuctionSearchOverlay.shouldReplace()) return true
@@ -349,4 +349,6 @@ object NEUItems {
val jsonObject = ConfigManager.gson.fromJson(jsonString, JsonObject::class.java)
return manager.jsonToStack(jsonObject, false)
}
+
+ fun NeuRecipe.allIngredients(): Set<Ingredient> = ingredients
}