mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
mentioning expected recipe type in error messages (makes it easier figuring out issues when overwriting recipes that had a non-default = shaped type)
This commit is contained in:
parent
34f06cecfc
commit
fbb1fd748b
@ -129,11 +129,17 @@ object Recipes {
|
|||||||
def addRecipe(output: ItemStack, list: Config, name: String) = try {
|
def addRecipe(output: ItemStack, list: Config, name: String) = try {
|
||||||
if (list.hasPath(name)) {
|
if (list.hasPath(name)) {
|
||||||
val recipe = list.getConfig(name)
|
val recipe = list.getConfig(name)
|
||||||
tryGetType(recipe) match {
|
val recipeType = tryGetType(recipe)
|
||||||
case "shaped" => addShapedRecipe(output, recipe)
|
try {
|
||||||
case "shapeless" => addShapelessRecipe(output, recipe)
|
recipeType match {
|
||||||
case "furnace" => addFurnaceRecipe(output, recipe)
|
case "shaped" => addShapedRecipe(output, recipe)
|
||||||
case other => throw new RecipeException("Invalid recipe type '" + other + "'.")
|
case "shapeless" => addShapelessRecipe(output, recipe)
|
||||||
|
case "furnace" => addFurnaceRecipe(output, recipe)
|
||||||
|
case other => OpenComputers.log.warning("Failed adding recipe for '" + name + "', you will not be able to craft this item! The error was: Invalid recipe type '" + other + "'.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
case e: RecipeException => OpenComputers.log.warning("Failed adding " + recipeType + " recipe for '" + name + "', you will not be able to craft this item! The error was: " + e.getMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -141,7 +147,6 @@ object Recipes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
case e: RecipeException => OpenComputers.log.warning("Failed adding recipe for '" + name + "', you will not be able to craft this item! The error was: " + e.getMessage)
|
|
||||||
case e: Throwable => OpenComputers.log.log(Level.SEVERE, "Failed adding recipe for '" + name + "', you will not be able to craft this item!", e)
|
case e: Throwable => OpenComputers.log.log(Level.SEVERE, "Failed adding recipe for '" + name + "', you will not be able to craft this item!", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +288,8 @@ object Recipes {
|
|||||||
|
|
||||||
private def cartesianProduct[T](xss: List[List[T]]): List[List[T]] = xss match {
|
private def cartesianProduct[T](xss: List[List[T]]): List[List[T]] = xss match {
|
||||||
case Nil => List(Nil)
|
case Nil => List(Nil)
|
||||||
case h :: t => for (xh <- h; xt <- cartesianProduct(t)) yield xh :: xt
|
case h :: t => for (xh <- h;
|
||||||
|
xt <- cartesianProduct(t)) yield xh :: xt
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RecipeException(message: String) extends RuntimeException(message)
|
private class RecipeException(message: String) extends RuntimeException(message)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user