diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-07-06 13:33:03 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-07-06 13:33:03 +0200 |
commit | 9562d7a980b4d92d0bc8af8e2bf52cf398349d63 (patch) | |
tree | c711227dec8ed7074f57d656278ced0c33fa28f2 /src/main/java | |
parent | 7c488b9741ca089e4419a5cc1ea44bad99ae6cea (diff) | |
download | skyhanni-9562d7a980b4d92d0bc8af8e2bf52cf398349d63.tar.gz skyhanni-9562d7a980b4d92d0bc8af8e2bf52cf398349d63.tar.bz2 skyhanni-9562d7a980b4d92d0bc8af8e2bf52cf398349d63.zip |
fixed stack overflow errors
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 3a60dd3f4..79b57fcf7 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -423,13 +423,15 @@ object ItemUtils { return neededItems } - // TODO remove debugs once stack overflow is found - fun getRecipePrice(recipe: NeuRecipe): Double { - println("getRecipePrice ${recipe.title}") - return neededItems(recipe).map { - println("ingredient: ${it.key}") - it.key.getPrice() * it.value + fun getRecipePrice(recipe: NeuRecipe): Double = + neededItems(recipe).map { + // prevents stack overflow errors with ENDERMAN_MONSTER + if (it.key.endsWith("_MONSTER")) { + 0.0 + } else { + it.key.getPrice() * it.value + } }.sum() - } + } |