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

View File

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

View File

@ -4,7 +4,6 @@
# already known recipes).
include file("default.recipes")
#include file("buildcraft.recipes")
#include file("gregtech.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 java.io.{FileReader, File}
import java.util.logging.Level
import li.cil.oc.util.mods.GregTech
import net.minecraft.block.Block
import net.minecraft.item.crafting.FurnaceRecipes
import net.minecraft.item.{ItemStack, Item}
@ -135,6 +136,7 @@ object Recipes {
case "shaped" => addShapedRecipe(output, recipe)
case "shapeless" => addShapelessRecipe(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 + "'.")
}
}
@ -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) {
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) =