diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/package.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/package.lua index b83119b0b..cd8bf10fa 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/package.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/package.lua @@ -1,6 +1,6 @@ local package = {} -package.path = "/lib/?.lua;/usr/lib/?.lua;/home/lib/?.lua;./?.lua" +package.path = "/lib/?.lua;/usr/lib/?.lua;/home/lib/?.lua;./?.lua;/lib/?/init.lua;/usr/lib/?/init.lua;/home/lib/?/init.lua;./?/init.lua" local loading = {} diff --git a/src/main/resources/assets/opencomputers/recipes/default.recipes b/src/main/resources/assets/opencomputers/recipes/default.recipes index 51fc286bd..d80b8745b 100644 --- a/src/main/resources/assets/opencomputers/recipes/default.recipes +++ b/src/main/resources/assets/opencomputers/recipes/default.recipes @@ -36,6 +36,15 @@ luaBios { type: shapeless input: ["oc:eeprom", "oc:manual"] } +generic: [ + { + result: {block="minecraft:end_stone"} + input: [[enderPearl, sandstone, enderPearl] + [sandstone, blockCoal, sandstone] + [enderPearl, sandstone, enderPearl]] + output: 4 + } +] droneCase1 { input: [[{block="minecraft:end_stone"}, compass, {block="minecraft:end_stone"}] diff --git a/src/main/scala/li/cil/oc/common/recipe/Recipes.scala b/src/main/scala/li/cil/oc/common/recipe/Recipes.scala index d1846f00a..82a5fd70b 100644 --- a/src/main/scala/li/cil/oc/common/recipe/Recipes.scala +++ b/src/main/scala/li/cil/oc/common/recipe/Recipes.scala @@ -139,7 +139,7 @@ object Recipes { val value = recipes.getValue(name) value.valueType match { case ConfigValueType.OBJECT => - addRecipe(stack, recipes.getConfig(name), "'" + name + "'") + addRecipe(stack, recipes.getConfig(name), s"'$name'") case ConfigValueType.BOOLEAN => // Explicitly disabled, keep in NEI if true. if (!value.unwrapped.asInstanceOf[Boolean]) { @@ -162,7 +162,7 @@ object Recipes { for (recipe <- lootRecipes) { val name = recipe.getString("name") Loot.builtInDisks.get(name) match { - case Some((stack, _)) => addRecipe(stack, recipe, "loot disk '" + name + "'") + case Some((stack, _)) => addRecipe(stack, recipe, s"loot disk '$name'") case _ => OpenComputers.log.warn(s"Failed adding recipe for loot disk '$name': No such global loot disk.") hadErrors = true @@ -175,6 +175,24 @@ object Recipes { hadErrors = true } + if (recipes.hasPath("generic")) try { + val genericRecipes = recipes.getConfigList("generic") + for (recipe <- genericRecipes) { + val result = recipe.getValue("result").unwrapped() + parseIngredient(result) match { + case stack: ItemStack => addRecipe(stack, recipe, s"'$result'") + case _ => + OpenComputers.log.warn(s"Failed adding generic recipe for '$result': Invalid output (make sure it's not an OreDictionary name).") + hadErrors = true + } + } + } + catch { + case t: Throwable => + OpenComputers.log.warn("Failed parsing generic recipes.", t) + hadErrors = true + } + // Recrafting operations. val navigationUpgrade = api.Items.get(Constants.ItemName.NavigationUpgrade) val mcu = api.Items.get(Constants.BlockName.Microcontroller) @@ -324,7 +342,7 @@ object Recipes { def tryGetCount(recipe: Config) = if (recipe.hasPath("output")) recipe.getInt("output") else 1 - def parseIngredient(entry: AnyRef) = entry match { + def parseIngredient(entry: AnyRef): AnyRef = entry match { case map: java.util.Map[AnyRef, AnyRef]@unchecked => if (map.contains("oreDict")) { map.get("oreDict") match { diff --git a/src/main/scala/li/cil/oc/integration/appeng/DriverController.scala b/src/main/scala/li/cil/oc/integration/appeng/DriverController.scala index 13d83ce8d..fdf3a09c7 100644 --- a/src/main/scala/li/cil/oc/integration/appeng/DriverController.scala +++ b/src/main/scala/li/cil/oc/integration/appeng/DriverController.scala @@ -57,7 +57,7 @@ object DriverController extends DriverTileEntity with EnvironmentAware { class Environment(tileEntity: AETile) extends ManagedTileEntityEnvironment[AETile](tileEntity, "me_controller") with NamedBlock { override def preferredName = "me_controller" - override def priority = 0 + override def priority = 5 @Callback(doc = "function():table -- Get a list of tables representing the available CPUs in the network.") def getCpus(context: Context, args: Arguments): Array[AnyRef] = @@ -281,4 +281,4 @@ object DriverController extends DriverTileEntity with EnvironmentAware { } } -} \ No newline at end of file +}