From 772d5ae117e27663f8089844596119ae4d0ba543 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 27 Apr 2024 11:42:45 +0200 Subject: Fix: Visitor Supercraft (#1550) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt | 5 +++-- src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') 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() 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 = ingredients } -- cgit