Skip to content

Commit

Permalink
fixed stack overflow errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Jul 6, 2024
1 parent 7c488b9 commit 9562d7a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}


}

0 comments on commit 9562d7a

Please sign in to comment.