From 9562d7a980b4d92d0bc8af8e2bf52cf398349d63 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 6 Jul 2024 13:33:03 +0200 Subject: fixed stack overflow errors --- src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/main/java') 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() - } + } -- cgit