inlined getOreNameOrItemStackFromName

This commit is contained in:
Florian Nücke 2013-12-25 00:55:07 +01:00
parent 76cec04771
commit 98832e18f8

View File

@ -211,11 +211,7 @@ object Recipes {
}
}
else throw new RecipeException("Invalid ingredient type (no oreDict, item or block entry).")
case name: String => getOreNameOrItemStackFromName(name)
case _ => throw new RecipeException("Invalid ingredient type (not a map or string).")
}
private def getOreNameOrItemStackFromName(name: String) =
case name: String =>
if (name == null || name.trim.isEmpty) null
else if (OreDictionary.getOres(name) != null && !OreDictionary.getOres(name).isEmpty) name
else {
@ -227,6 +223,8 @@ object Recipes {
}
}
}
case _ => throw new RecipeException("Invalid ingredient type (not a map or string).")
}
private def itemNameEquals(item: Item, name: String) =
item != null && (item.getUnlocalizedName == name || item.getUnlocalizedName == "item." + name)