mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Trying to prevent NPE in item cost computation.
This commit is contained in:
parent
56184a210a
commit
f4f6881bdd
@ -100,7 +100,9 @@ object ItemCosts {
|
||||
}
|
||||
else {
|
||||
val recipes = CraftingManager.getInstance.getRecipeList.map(_.asInstanceOf[IRecipe])
|
||||
val recipe = recipes.find(recipe => recipe.getRecipeOutput != null && fuzzyEquals(stack, recipe.getRecipeOutput))
|
||||
if (recipes == null) Iterable((stack, 1.0))
|
||||
else {
|
||||
val recipe = recipes.filter(_ != null).find(recipe => recipe.getRecipeOutput != null && fuzzyEquals(stack, recipe.getRecipeOutput))
|
||||
val (ingredients, output) = recipe match {
|
||||
case Some(recipe: ShapedRecipes) => (recipe.recipeItems.flatMap(accumulate(_, path :+ stack)).toIterable, recipe.getRecipeOutput.stackSize)
|
||||
case Some(recipe: ShapelessRecipes) => (recipe.recipeItems.flatMap(accumulate(_, path :+ stack)).toIterable, recipe.getRecipeOutput.stackSize)
|
||||
@ -120,6 +122,7 @@ object ItemCosts {
|
||||
scaled
|
||||
}
|
||||
}
|
||||
}
|
||||
case list: util.ArrayList[ItemStack]@unchecked if !list.isEmpty =>
|
||||
var result = Iterable.empty[(ItemStack, Double)]
|
||||
for (stack <- list if result.isEmpty) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user