Merge branch '1.1' of cil.li:oc into 1.1

Conflicts:
	li/cil/oc/Recipes.scala
This commit is contained in:
Florian Nücke 2013-12-28 21:28:09 +01:00
commit 954f357c44
4 changed files with 67 additions and 27 deletions

View File

@ -67,13 +67,13 @@ wlanCard {
} }
craftingUpgrade { craftingUpgrade {
input: [[ingotIron, pistonBase, ingotIron] input: [[ingotIron, craftingPiston, ingotIron]
["oc:circuitBasic", workbench, "oc:circuitBasic"] ["oc:circuitBasic", workbench, "oc:circuitBasic"]
[ingotIron, "oc:craftingCircuitBoardPrinted", ingotIron]] [ingotIron, "oc:craftingCircuitBoardPrinted", ingotIron]]
} }
generatorUpgrade { generatorUpgrade {
input: [[ingotIron, "", ingotIron] input: [[ingotIron, "", ingotIron]
["oc:circuitBasic", pistonBase, "oc:circuitBasic"] ["oc:circuitBasic", craftingPiston, "oc:circuitBasic"]
["oc:craftingCircuitBoardPrinted", ingotIron, "oc:craftingCircuitBoardPrinted"]] ["oc:craftingCircuitBoardPrinted", ingotIron, "oc:craftingCircuitBoardPrinted"]]
} }
navigationUpgrade { navigationUpgrade {
@ -83,12 +83,12 @@ navigationUpgrade {
} }
signUpgrade { signUpgrade {
input: [[ingotIron, dyePowder, ingotIron] input: [[ingotIron, dyePowder, ingotIron]
["oc:circuitAdvanced", stickWood, "oc:circuitAdvanced"] ["oc:circuitBasic", stickWood, "oc:circuitBasic"]
[ingotIron, pistonStickyBase, ingotIron]] [ingotIron, pistonStickyBase, ingotIron]]
} }
solarGeneratorUpgrade { solarGeneratorUpgrade {
input: [[glass, glass, glass] input: [[glass, glass, glass]
["oc:circuitAdvanced", "oc:craftingGenerator", "oc:circuitAdvanced"]] ["oc:circuitElite", "oc:craftingGenerator", "oc:circuitElite"]]
} }
nuggetIron { nuggetIron {
@ -101,7 +101,7 @@ cuttingWire {
} }
acid { acid {
type: shapeless type: shapeless
input: [bucketWater, sugar, slimeball, spiderEye, bone, {item=dyePowder, subID=1}] input: [bucketWater, sugar, slimeball, fermentedSpiderEye, bone, {item=dyePowder, subID=1}]
} }
disk { disk {
input: [["", nuggetIron, ""] input: [["", nuggetIron, ""]

View File

@ -9,7 +9,7 @@ analyzer {
ram1 { ram1 {
type:assembly type:assembly
input: ["oc:circuitBasic", "oc:craftingCircuitBoardPrinted"] input: [{item="oc:item",subID=24}, {item="oc:item",subID=32}]
number:[3,3] number:[3,3]
eu:32 eu:32
time=250 time=250
@ -75,23 +75,22 @@ generatorUpgrade {
["oc:circuitAdvanced",craftingGenerator , "oc:circuitAdvanced"] ["oc:circuitAdvanced",craftingGenerator , "oc:circuitAdvanced"]
[screwStainlessSteel, craftingToolScrewdriver, screwStainlessSteel]] [screwStainlessSteel, craftingToolScrewdriver, screwStainlessSteel]]
} }
#todo navigationUpgrade {
#navigationUpgrade { input: [[craftingRawMachineTier02, compass, screwStainlessSteel]
# input: [[ingotGold, compass, ingotGold] ["oc:circuitElite", {item=map, subID=any}, "oc:circuitElite"]
# ["oc:circuitElite", {item=map, subID=32767}, "oc:circuitElite"] [screwStainlessSteel, potion, craftingToolScrewdriver]]
# [ingotGold, potion, ingotGold]] }
#} signUpgrade {
#todo input: [[screwAluminium, dyePowder, screwAluminium]
#signUpgrade { ["oc:circuitBasic", stickWood, "oc:circuitBasic"]
# input: [[ingotIron, dyePowder, ingotIron] [screwAluminium, craftingToolScrewdriver, screwAluminium]]
# ["oc:circuitAdvanced", stickWood, "oc:circuitAdvanced"] }
# [ingotIron, pistonStickyBase, ingotIron]]
#} solarGeneratorUpgrade {
#todo input: [[screwTitanium, "", screwTitanium]
#solarGeneratorUpgrade { ["oc:circuitElite", {item=GT_Components,subID=7} , "oc:circuitElite"]
# input: [[glass, glass, glass] [screwTitanium, craftingToolScrewdriver, screwTitanium]]
# ["oc:circuitAdvanced", "oc:craftingGenerator", "oc:circuitAdvanced"]] }
#}
cuttingWire { cuttingWire {
@ -111,7 +110,7 @@ disk {
transistor { transistor {
type:assembly type:assembly
input: [redstone, plateIron] input: [redstone, {item="GT_Materials",subID=64}]
number:[1,2] number:[1,2]
eu:16 eu:16
time=500 time=500
@ -136,7 +135,7 @@ chip2 {
} }
chip3 { chip3 {
type:assembly type:assembly
input: [{item=Components,subID=1}, {item="oc:item",subID=23}] input: [{item=GT_Components,subID=1}, {item="oc:item",subID=23}]
number:[1,16] number:[1,16]
eu:25 eu:25
time=800 time=800

View File

@ -4,7 +4,6 @@
# already known recipes). # already known recipes).
include file("default.recipes") include file("default.recipes")
#include file("buildcraft.recipes")
#include file("gregtech.recipes") #include file("gregtech.recipes")
#include file("your_custom.recipes") #include file("your_custom.recipes")

View File

@ -5,6 +5,7 @@ import cpw.mods.fml.common.Loader
import cpw.mods.fml.common.registry.GameRegistry import cpw.mods.fml.common.registry.GameRegistry
import java.io.{FileReader, File} import java.io.{FileReader, File}
import java.util.logging.Level import java.util.logging.Level
import li.cil.oc.util.mods.GregTech
import net.minecraft.block.Block import net.minecraft.block.Block
import net.minecraft.item.crafting.FurnaceRecipes import net.minecraft.item.crafting.FurnaceRecipes
import net.minecraft.item.{ItemStack, Item} import net.minecraft.item.{ItemStack, Item}
@ -135,6 +136,7 @@ object Recipes {
case "shaped" => addShapedRecipe(output, recipe) case "shaped" => addShapedRecipe(output, recipe)
case "shapeless" => addShapelessRecipe(output, recipe) case "shapeless" => addShapelessRecipe(output, recipe)
case "furnace" => addFurnaceRecipe(output, recipe) case "furnace" => addFurnaceRecipe(output, recipe)
case "assembly" => addAssemblyRecipe(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 + "'.") 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 + "'.")
} }
} }
@ -193,6 +195,46 @@ object Recipes {
} }
} }
private def addAssemblyRecipe(stack: ItemStack, recipe: Config) {
val input = recipe.getValue("input").unwrapped() match {
case list: java.util.List[Object] => list.map(parseIngredient)
case other => Seq(parseIngredient(other))
}
val number = recipe.getValue("number").unwrapped().asInstanceOf[java.util.List[Object]]
var input1: ItemStack = null
var input2: ItemStack = null
if (input.size < 1 || input.size > 2) {
throw new RecipeException("Invalid recipe length: " + input.size + ".")
}
if (number.size() != input.size) {
throw new RecipeException("Invalid number length, expected: " + input.size + " got: " + number.size + ".")
}
val eu = recipe.getValue("eu").unwrapped().asInstanceOf[Integer]
val duration = recipe.getValue("time").unwrapped().asInstanceOf[Integer]
val output = stack.copy()
output.stackSize = tryGetCount(recipe)
input(0) match {
case value: ItemStack =>
input1 = value
input1.stackSize = number(0).asInstanceOf[Integer]
case other => throw new RecipeException("Invalid recipe type expected ItemStack got: " + other + ".")
}
if (input.size == 2) {
input(1) match {
case value: ItemStack =>
input2 = value
input2.stackSize = number(1).asInstanceOf[Integer]
case other => throw new RecipeException("Invalid recipe type expected ItemStack got: " + other + ".")
}
}
if (input1 != null) {
GregTech.addAssemblerRecipe(input1, input2, output, duration, eu)
}
}
private def addFurnaceRecipe(stack: ItemStack, recipe: Config) { private def addFurnaceRecipe(stack: ItemStack, recipe: Config) {
val input = parseIngredient(recipe.getValue("input").unwrapped()) val input = parseIngredient(recipe.getValue("input").unwrapped())
@ -253,7 +295,7 @@ object Recipes {
} }
} }
} }
case other => throw new RecipeException("Invalid ingredient type (not a map or string): "+other) case other => throw new RecipeException("Invalid ingredient type (not a map or string): " + other)
} }
private def itemNameEquals(item: Item, name: String) = private def itemNameEquals(item: Item, name: String) =