Some localization.

Removed robot recipes.
Some fixes here and there.
This commit is contained in:
Florian Nücke 2014-05-17 15:11:22 +02:00
parent a5a8833288
commit 5c5e858c3d
16 changed files with 133 additions and 148 deletions

View File

@ -20,6 +20,7 @@ oc:tile.PowerDistributor.name=Stromverteiler
oc:tile.Redstone.name=Redstone-I/O oc:tile.Redstone.name=Redstone-I/O
oc:tile.Robot.name=Roboter oc:tile.Robot.name=Roboter
oc:tile.RobotAfterimage.name=Roboter oc:tile.RobotAfterimage.name=Roboter
oc:tile.RobotAssembler.name=Roboter-Werkbank
oc:tile.Router.name=Switch oc:tile.Router.name=Switch
oc:tile.Screen0.name=Bildschirm (Stufe 1) oc:tile.Screen0.name=Bildschirm (Stufe 1)
oc:tile.Screen1.name=Bildschirm (Stufe 2) oc:tile.Screen1.name=Bildschirm (Stufe 2)
@ -117,9 +118,10 @@ oc:gui.Error.OutOfMemory=Nicht genug Arbeitsspeicher.
oc:gui.Robot.Power=Energie oc:gui.Robot.Power=Energie
oc:gui.Robot.TurnOff=Ausschalten oc:gui.Robot.TurnOff=Ausschalten
oc:gui.Robot.TurnOn=Einschalten oc:gui.Robot.TurnOn=Einschalten
oc:gui.RobotAssembler.CollectRobot=Roboter entnehmen
oc:gui.RobotAssembler.Complexity=Komplexität: %s/%s oc:gui.RobotAssembler.Complexity=Komplexität: %s/%s
oc:gui.RobotAssembler.InsertCase=Computergehäuse einlegen oc:gui.RobotAssembler.InsertCase=Computergehäuse einlegen
oc:gui.RobotAssembler.Run=Bauen oc:gui.RobotAssembler.Run=Zusammenbauen
oc:gui.ServerRack.None=Keine oc:gui.ServerRack.None=Keine
oc:gui.ServerRack.Back=Hinten oc:gui.ServerRack.Back=Hinten
oc:gui.ServerRack.Bottom=Unten oc:gui.ServerRack.Bottom=Unten
@ -188,6 +190,7 @@ oc:tooltip.Robot=Im Gegensatz zu normalen Computern können sich Roboter in der
# The underscore makes sure this isn't hidden with the rest of the tooltip. # The underscore makes sure this isn't hidden with the rest of the tooltip.
oc:tooltip.Robot_Level=§fStufe§7: §a%s§7. oc:tooltip.Robot_Level=§fStufe§7: §a%s§7.
oc:tooltip.Robot_StoredEnergy=§fGespeicherte Energie§7: §a%s§7. oc:tooltip.Robot_StoredEnergy=§fGespeicherte Energie§7: §a%s§7.
oc:tooltip.RobotAssembler=Erlaubt das Bauen von Robotern aus diversen anderen Computerteilen.
oc:tooltip.Router=Erlaubt es, mehrere Netzwerke miteinander zu verbinden. Leitet ausschließlich Netzwerknachrichten weiter, Komponenten "hinter" dem Switch sind nicht sichtbar. Nützlich, um Netzwerke zu trennen, jedoch nach wie vor Kommunikation zwischen den Netzwerken zu erlauben, z.b. mittels Netzwerkkarten. oc:tooltip.Router=Erlaubt es, mehrere Netzwerke miteinander zu verbinden. Leitet ausschließlich Netzwerknachrichten weiter, Komponenten "hinter" dem Switch sind nicht sichtbar. Nützlich, um Netzwerke zu trennen, jedoch nach wie vor Kommunikation zwischen den Netzwerken zu erlauben, z.b. mittels Netzwerkkarten.
oc:tooltip.Screen=Zeigt Text an, gesteuert von Grafikkarten in Computern.[nl] Höchstauflösung: §f%sx%s§7.[nl] Maximale Farbtiefe: §f%s§7. oc:tooltip.Screen=Zeigt Text an, gesteuert von Grafikkarten in Computern.[nl] Höchstauflösung: §f%sx%s§7.[nl] Maximale Farbtiefe: §f%s§7.
oc:tooltip.Server=Ein Server kann wie ein gewöhnliches Computergehäuse mit Komponenten verbessert werden. Um den Server zu starten, muss er in einem Servergehäuse installiert werden.[nl] Anzahl unterstützter Fernbedienungen: §f%s§7. oc:tooltip.Server=Ein Server kann wie ein gewöhnliches Computergehäuse mit Komponenten verbessert werden. Um den Server zu starten, muss er in einem Servergehäuse installiert werden.[nl] Anzahl unterstützter Fernbedienungen: §f%s§7.

View File

@ -20,6 +20,7 @@ oc:tile.PowerDistributor.name=Power Distributor
oc:tile.Redstone.name=Redstone I/O oc:tile.Redstone.name=Redstone I/O
oc:tile.Robot.name=Robot oc:tile.Robot.name=Robot
oc:tile.RobotAfterimage.name=Robot oc:tile.RobotAfterimage.name=Robot
oc:tile.RobotAssembler.name=Robot Assembler
oc:tile.Router.name=Switch oc:tile.Router.name=Switch
oc:tile.Screen0.name=Screen (Tier 1) oc:tile.Screen0.name=Screen (Tier 1)
oc:tile.Screen1.name=Screen (Tier 2) oc:tile.Screen1.name=Screen (Tier 2)
@ -117,6 +118,7 @@ oc:gui.Error.OutOfMemory=Out of memory.
oc:gui.Robot.Power=Energy oc:gui.Robot.Power=Energy
oc:gui.Robot.TurnOff=Turn off oc:gui.Robot.TurnOff=Turn off
oc:gui.Robot.TurnOn=Turn on oc:gui.Robot.TurnOn=Turn on
oc:gui.RobotAssembler.CollectRobot=Collect robot
oc:gui.RobotAssembler.Complexity=Complexity: %s/%s oc:gui.RobotAssembler.Complexity=Complexity: %s/%s
oc:gui.RobotAssembler.InsertCase=Insert a Computer Case oc:gui.RobotAssembler.InsertCase=Insert a Computer Case
oc:gui.RobotAssembler.Run=Assemble oc:gui.RobotAssembler.Run=Assemble
@ -188,6 +190,7 @@ oc:tooltip.Robot=Unlike computers, robots can move around and interact with the
# The underscore makes sure this isn't hidden with the rest of the tooltip. # The underscore makes sure this isn't hidden with the rest of the tooltip.
oc:tooltip.Robot_Level=§fLevel§7: §a%s§7. oc:tooltip.Robot_Level=§fLevel§7: §a%s§7.
oc:tooltip.Robot_StoredEnergy=§fStored energy§7: §a%s§7. oc:tooltip.Robot_StoredEnergy=§fStored energy§7: §a%s§7.
oc:tooltip.RobotAssembler=Allows constructing robots from a number of different computer parts.
oc:tooltip.Router=Allows connecting different networks to each other. Only network messages will be passed along, components will not be visible through this. Use this to separate networks while still allowing communication using Network Cards, for example. oc:tooltip.Router=Allows connecting different networks to each other. Only network messages will be passed along, components will not be visible through this. Use this to separate networks while still allowing communication using Network Cards, for example.
oc:tooltip.Screen=Display text, controlled by a Graphics Card in a Case.[nl] Maximum resolution: §f%sx%s§7.[nl] Maximum color depth: §f%s§7. oc:tooltip.Screen=Display text, controlled by a Graphics Card in a Case.[nl] Maximum resolution: §f%sx%s§7.[nl] Maximum color depth: §f%s§7.
oc:tooltip.Server=This is a server, there are many like it, but this one can be upgraded with components much like a computer case can be. It can be run by inserting it into a server rack.[nl] Number of supported terminals: §f%s§7. oc:tooltip.Server=This is a server, there are many like it, but this one can be upgraded with components much like a computer case can be. It can be run by inserting it into a server rack.[nl] Number of supported terminals: §f%s§7.

View File

@ -370,11 +370,6 @@ redstone {
[blockRedstone, "oc:redstoneCard", blockRedstone] [blockRedstone, "oc:redstoneCard", blockRedstone]
[ingotIron, "oc:materialCircuitBoardPrinted", ingotIron]] [ingotIron, "oc:materialCircuitBoardPrinted", ingotIron]]
} }
robot {
input: [["oc:screen1", "oc:graphicsCard1", "oc:diskDrive"]
[dispenser, "oc:case1", "oc:ram1"]
["oc:capacitor", minecartHopper, "oc:capacitor"]]
}
robotAssembler { robotAssembler {
input: [[ingotIron, workbench, ingotIron] input: [[ingotIron, workbench, ingotIron]
[craftingPiston, "oc:circuitChip2", craftingPiston] [craftingPiston, "oc:circuitChip2", craftingPiston]

View File

@ -286,11 +286,6 @@ redstone {
[{block=BlockMetaID_Machine, subID=69}, craftingRawMachineTier02, "oc:redstoneCard"] [{block=BlockMetaID_Machine, subID=69}, craftingRawMachineTier02, "oc:redstoneCard"]
["oc:circuitChip2", "oc:materialCircuitBoardPrinted", "oc:circuitChip2"]] ["oc:circuitChip2", "oc:materialCircuitBoardPrinted", "oc:circuitChip2"]]
} }
robot {
input: [["oc:screen1", "oc:graphicsCard1", "oc:diskDrive"]
[{block=BlockMetaID_Machine, subID=46}, craftingRawMachineTier02, "oc:ram1"]
[{item=Electric, subID=7}, craftingToolWrench, {item=Electric, subID=7}]]
}
switch { switch {
input: [["", "oc:lanCard", ""] input: [["", "oc:lanCard", ""]
["oc:cable", craftingRawMachineTier02, "oc:cable"] ["oc:cable", craftingRawMachineTier02, "oc:cable"]

View File

@ -302,11 +302,6 @@ redstone {
[blockRedstone, "oc:redstoneCard", blockRedstone] [blockRedstone, "oc:redstoneCard", blockRedstone]
[ingotIron, "oc:materialCircuitBoardPrinted", ingotIron]] [ingotIron, "oc:materialCircuitBoardPrinted", ingotIron]]
} }
robot {
input: [["oc:screen1", "oc:graphicsCard1", "oc:diskDrive"]
[dispenser, "oc:case1", "oc:ram1"]
["oc:capacitor", minecartHopper, "oc:capacitor"]]
}
switch { switch {
input: [[ingotIron, "oc:cable", ingotIron] input: [[ingotIron, "oc:cable", ingotIron]
["oc:cable", "oc:lanCard", "oc:cable"] ["oc:cable", "oc:lanCard", "oc:cable"]

View File

@ -3,8 +3,6 @@ package li.cil.oc
import cpw.mods.fml.common.registry.GameRegistry import cpw.mods.fml.common.registry.GameRegistry
import li.cil.oc.common.block._ import li.cil.oc.common.block._
import li.cil.oc.common.tileentity import li.cil.oc.common.tileentity
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
import li.cil.oc.common.recipe.Recipes import li.cil.oc.common.recipe.Recipes
object Blocks { object Blocks {
@ -13,24 +11,14 @@ object Blocks {
var blockSpecial: SpecialDelegator = _ var blockSpecial: SpecialDelegator = _
var blockSpecialWithRedstone: SpecialDelegator = _ var blockSpecialWithRedstone: SpecialDelegator = _
var cable: Cable = _
var robotProxy: RobotProxy = _ var robotProxy: RobotProxy = _
var robotAfterimage: RobotAfterimage = _ var robotAfterimage: RobotAfterimage = _
var screen1, screen2, screen3: Screen = _
def init() { def init() {
blockSimple = new SimpleDelegator(Settings.get.blockId1) blockSimple = new SimpleDelegator(Settings.get.blockId1)
blockSimpleWithRedstone = new SimpleRedstoneDelegator(Settings.get.blockId2) blockSimpleWithRedstone = new SimpleRedstoneDelegator(Settings.get.blockId2)
blockSpecial = new SpecialDelegator(Settings.get.blockId3) blockSpecial = new SpecialDelegator(Settings.get.blockId3)
blockSpecialWithRedstone = new SpecialRedstoneDelegator(Settings.get.blockId4) { blockSpecialWithRedstone = new SpecialRedstoneDelegator(Settings.get.blockId4)
override def subBlockItemStacks() = super.subBlockItemStacks() ++ Iterable({
val stack = new ItemStack(this, 1, robotProxy.blockId)
stack.setTagCompound(new NBTTagCompound("tag"))
stack.getTagCompound.setDouble(Settings.namespace + "xp", Settings.get.baseXpToLevel + math.pow(30.0001 * Settings.get.constantXpGrowth, Settings.get.exponentialXpGrowth))
stack.getTagCompound.setInteger(Settings.namespace + "storedEnergy", (Settings.get.bufferRobot + Settings.get.bufferPerLevel * 30).toInt)
stack
})
}
GameRegistry.registerBlock(blockSimple, classOf[Item], Settings.namespace + "simple") GameRegistry.registerBlock(blockSimple, classOf[Item], Settings.namespace + "simple")
GameRegistry.registerBlock(blockSimpleWithRedstone, classOf[Item], Settings.namespace + "simple_redstone") GameRegistry.registerBlock(blockSimpleWithRedstone, classOf[Item], Settings.namespace + "simple_redstone")
@ -59,44 +47,40 @@ object Blocks {
// IMPORTANT: the multi block must come first, since the sub blocks will // IMPORTANT: the multi block must come first, since the sub blocks will
// try to register with it. Also, the order the sub blocks are created in // try to register with it. Also, the order the sub blocks are created in
// must not be changed since that order determines their actual IDs. // must not be changed since that order determines their actual IDs.
Recipes.addBlockDelegate(new Adapter(blockSimple), "adapter", "oc:adapter") Recipes.addBlock(new Adapter(blockSimple), "adapter", "oc:adapter")
cable = Recipes.addBlockDelegate(new Cable(blockSpecial), "cable", "oc:cable") Recipes.addBlock(new Cable(blockSpecial), "cable", "oc:cable")
Recipes.addBlockDelegate(new Capacitor(blockSimple), "capacitor", "oc:capacitor") Recipes.addBlock(new Capacitor(blockSimple), "capacitor", "oc:capacitor")
Recipes.addBlockDelegate(new Case.Tier1(blockSimpleWithRedstone), "case1", "oc:case1") Recipes.addBlock(new Case.Tier1(blockSimpleWithRedstone), "case1", "oc:case1")
Recipes.addBlockDelegate(new Case.Tier2(blockSimpleWithRedstone), "case2", "oc:case2") Recipes.addBlock(new Case.Tier2(blockSimpleWithRedstone), "case2", "oc:case2")
Recipes.addBlockDelegate(new Case.Tier3(blockSimpleWithRedstone), "case3", "oc:case3") Recipes.addBlock(new Case.Tier3(blockSimpleWithRedstone), "case3", "oc:case3")
Recipes.addBlockDelegate(new Charger(blockSimpleWithRedstone), "charger", "oc:charger") Recipes.addBlock(new Charger(blockSimpleWithRedstone), "charger", "oc:charger")
Recipes.addBlockDelegate(new DiskDrive(blockSimple), "diskDrive", "oc:diskDrive") Recipes.addBlock(new DiskDrive(blockSimple), "diskDrive", "oc:diskDrive")
Recipes.addBlockDelegate(new Keyboard(blockSpecial), "keyboard", "oc:keyboard") Recipes.addBlock(new Keyboard(blockSpecial), "keyboard", "oc:keyboard")
Recipes.addBlockDelegate(new PowerDistributor(blockSimple), "powerDistributor", "oc:powerDistributor") Recipes.addBlock(new PowerDistributor(blockSimple), "powerDistributor", "oc:powerDistributor")
Recipes.addBlockDelegate(new PowerConverter(blockSimple), "powerConverter", "oc:powerConverter") Recipes.addBlock(new PowerConverter(blockSimple), "powerConverter", "oc:powerConverter")
Recipes.addBlockDelegate(new Redstone(blockSimpleWithRedstone), "redstone", "oc:redstone") Recipes.addBlock(new Redstone(blockSimpleWithRedstone), "redstone", "oc:redstone")
robotAfterimage = new RobotAfterimage(blockSpecial) robotAfterimage = new RobotAfterimage(blockSpecial)
robotProxy = Recipes.addBlockDelegate(new RobotProxy(blockSpecialWithRedstone), "robot", "oc:robot") robotProxy = Items.registerBlock(new RobotProxy(blockSpecialWithRedstone), "robot")
Recipes.addBlockDelegate(new Switch(blockSimple), "switch", "oc:switch") Recipes.addBlock(new Switch(blockSimple), "switch", "oc:switch")
screen1 = Recipes.addBlockDelegate(new Screen.Tier1(blockSimpleWithRedstone), "screen1", "oc:screen1") // Copied to simple block for automatic conversion from old format (when
screen2 = Recipes.addBlockDelegate(new Screen.Tier2(blockSimpleWithRedstone), "screen2", "oc:screen2") // screens did not take redstone inputs) to keep save format compatible.
screen3 = Recipes.addBlockDelegate(new Screen.Tier3(blockSimpleWithRedstone), "screen3", "oc:screen3") blockSimple.subBlocks += Recipes.addBlock(new Screen.Tier1(blockSimpleWithRedstone), "screen1", "oc:screen1")
blockSimple.subBlocks += Recipes.addBlock(new Screen.Tier2(blockSimpleWithRedstone), "screen2", "oc:screen2")
// For automatic conversion from old format (when screens did not take blockSimple.subBlocks += Recipes.addBlock(new Screen.Tier3(blockSimpleWithRedstone), "screen3", "oc:screen3")
// redstone inputs) to keep save format compatible.
blockSimple.subBlocks += screen1
blockSimple.subBlocks += screen2
blockSimple.subBlocks += screen3
// v1.2.0 // v1.2.0
Recipes.addBlockDelegate(new Rack(blockSpecialWithRedstone), "rack", "oc:rack") Recipes.addBlock(new Rack(blockSpecialWithRedstone), "rack", "oc:rack")
// v1.2.2 // v1.2.2
Recipes.addBlockDelegate(new Hologram.Tier1(blockSpecial), "hologram1", "oc:hologram1") Recipes.addBlock(new Hologram.Tier1(blockSpecial), "hologram1", "oc:hologram1")
Recipes.addBlockDelegate(new AccessPoint(blockSimple), "accessPoint", "oc:accessPoint") Recipes.addBlock(new AccessPoint(blockSimple), "accessPoint", "oc:accessPoint")
// v1.2.6 // v1.2.6
new Case.TierCreative(blockSimpleWithRedstone) new Case.TierCreative(blockSimpleWithRedstone)
// v1.3.0 // v1.3.0
Recipes.addBlockDelegate(new Hologram.Tier2(blockSpecial), "hologram2", "oc:hologram2") Recipes.addBlock(new Hologram.Tier2(blockSpecial), "hologram2", "oc:hologram2")
Recipes.addBlockDelegate(new Geolyzer(blockSimple), "geolyzer", "oc:geolyzer") Recipes.addBlock(new Geolyzer(blockSimple), "geolyzer", "oc:geolyzer")
Recipes.addBlockDelegate(new RobotAssembler(blockSpecial), "robotAssembler", "oc:robotAssembler") Recipes.addBlock(new RobotAssembler(blockSpecial), "robotAssembler", "oc:robotAssembler")
} }
} }

View File

@ -21,7 +21,7 @@ object Items extends ItemAPI {
case _ => null case _ => null
} }
def register(delegate: common.block.Delegate, name: String) { def registerBlock[T <: common.block.Delegate](delegate: T, name: String) = {
descriptors += name -> new ItemInfo { descriptors += name -> new ItemInfo {
override def block = delegate.parent override def block = delegate.parent
@ -30,9 +30,10 @@ object Items extends ItemAPI {
override def createItemStack(size: Int) = delegate.createItemStack(size) override def createItemStack(size: Int) = delegate.createItemStack(size)
} }
names += delegate -> name names += delegate -> name
delegate
} }
def register(instance: Block, name: String) { def registerBlock(instance: Block, name: String) = {
descriptors += name -> new ItemInfo { descriptors += name -> new ItemInfo {
override def block = instance override def block = instance
@ -41,9 +42,10 @@ object Items extends ItemAPI {
override def createItemStack(size: Int) = new ItemStack(instance, size) override def createItemStack(size: Int) = new ItemStack(instance, size)
} }
names += instance -> name names += instance -> name
instance
} }
def register(delegate: common.item.Delegate, name: String) { def registerItem[T <: common.item.Delegate](delegate: T, name: String) = {
descriptors += name -> new ItemInfo { descriptors += name -> new ItemInfo {
override def block = null override def block = null
@ -52,9 +54,10 @@ object Items extends ItemAPI {
override def createItemStack(size: Int) = delegate.createItemStack(size) override def createItemStack(size: Int) = delegate.createItemStack(size)
} }
names += delegate -> name names += delegate -> name
delegate
} }
def register(instance: Item, name: String) { def registerItem(instance: Item, name: String) = {
descriptors += name -> new ItemInfo { descriptors += name -> new ItemInfo {
override def block = null override def block = null
@ -63,6 +66,7 @@ object Items extends ItemAPI {
override def createItemStack(size: Int) = new ItemStack(instance, size) override def createItemStack(size: Int) = new ItemStack(instance, size)
} }
names += instance -> name names += instance -> name
instance
} }
private def getBlockOrItem(stack: ItemStack): Any = if (stack == null) null else { private def getBlockOrItem(stack: ItemStack): Any = if (stack == null) null else {
@ -93,92 +97,92 @@ object Items extends ItemAPI {
GameRegistry.registerItem(multi, Settings.namespace + "item") GameRegistry.registerItem(multi, Settings.namespace + "item")
Recipes.addItemDelegate(new item.Analyzer(multi), "analyzer", "oc:analyzer") Recipes.addItem(new item.Analyzer(multi), "analyzer", "oc:analyzer")
Recipes.addItemDelegate(new item.Memory(multi, 0), "ram1", "oc:ram1") Recipes.addItem(new item.Memory(multi, 0), "ram1", "oc:ram1")
Recipes.addItemDelegate(new item.Memory(multi, 2), "ram3", "oc:ram3") Recipes.addItem(new item.Memory(multi, 2), "ram3", "oc:ram3")
Recipes.addItemDelegate(new item.Memory(multi, 3), "ram4", "oc:ram4") Recipes.addItem(new item.Memory(multi, 3), "ram4", "oc:ram4")
Recipes.addItemDelegate(new item.FloppyDisk(multi), "floppy", "oc:floppy") Recipes.addItem(new item.FloppyDisk(multi), "floppy", "oc:floppy")
Recipes.addItemDelegate(new item.HardDiskDrive(multi, 0), "hdd1", "oc:hdd1") Recipes.addItem(new item.HardDiskDrive(multi, 0), "hdd1", "oc:hdd1")
Recipes.addItemDelegate(new item.HardDiskDrive(multi, 1), "hdd2", "oc:hdd2") Recipes.addItem(new item.HardDiskDrive(multi, 1), "hdd2", "oc:hdd2")
Recipes.addItemDelegate(new item.HardDiskDrive(multi, 2), "hdd3", "oc:hdd3") Recipes.addItem(new item.HardDiskDrive(multi, 2), "hdd3", "oc:hdd3")
Recipes.addItemDelegate(new item.GraphicsCard(multi, 0), "graphicsCard1", "oc:graphicsCard1") Recipes.addItem(new item.GraphicsCard(multi, 0), "graphicsCard1", "oc:graphicsCard1")
Recipes.addItemDelegate(new item.GraphicsCard(multi, 1), "graphicsCard2", "oc:graphicsCard2") Recipes.addItem(new item.GraphicsCard(multi, 1), "graphicsCard2", "oc:graphicsCard2")
Recipes.addItemDelegate(new item.GraphicsCard(multi, 2), "graphicsCard3", "oc:graphicsCard3") Recipes.addItem(new item.GraphicsCard(multi, 2), "graphicsCard3", "oc:graphicsCard3")
Recipes.addItemDelegate(new item.NetworkCard(multi), "lanCard", "oc:lanCard") Recipes.addItem(new item.NetworkCard(multi), "lanCard", "oc:lanCard")
Recipes.addItemDelegate(new item.RedstoneCard(multi), "redstoneCard", "oc:redstoneCard") Recipes.addItem(new item.RedstoneCard(multi), "redstoneCard", "oc:redstoneCard")
Recipes.addItemDelegate(new item.WirelessNetworkCard(multi), "wlanCard", "oc:wlanCard") Recipes.addItem(new item.WirelessNetworkCard(multi), "wlanCard", "oc:wlanCard")
Recipes.addItemDelegate(new item.UpgradeCrafting(multi), "craftingUpgrade", "oc:craftingUpgrade") Recipes.addItem(new item.UpgradeCrafting(multi), "craftingUpgrade", "oc:craftingUpgrade")
Recipes.addItemDelegate(new item.UpgradeGenerator(multi), "generatorUpgrade", "oc:generatorUpgrade") Recipes.addItem(new item.UpgradeGenerator(multi), "generatorUpgrade", "oc:generatorUpgrade")
ironNugget = new item.IronNugget(multi) ironNugget = new item.IronNugget(multi)
Recipes.addItemDelegate(new item.CuttingWire(multi), "cuttingWire", "oc:materialCuttingWire") Recipes.addItem(new item.CuttingWire(multi), "cuttingWire", "oc:materialCuttingWire")
Recipes.addItemDelegate(new item.Acid(multi), "acid", "oc:materialAcid") Recipes.addItem(new item.Acid(multi), "acid", "oc:materialAcid")
Recipes.addItemDelegate(new item.Disk(multi), "disk", "oc:materialDisk") Recipes.addItem(new item.Disk(multi), "disk", "oc:materialDisk")
Recipes.addItemDelegate(new item.ButtonGroup(multi), "buttonGroup", "oc:materialButtonGroup") Recipes.addItem(new item.ButtonGroup(multi), "buttonGroup", "oc:materialButtonGroup")
Recipes.addItemDelegate(new item.ArrowKeys(multi), "arrowKeys", "oc:materialArrowKey") Recipes.addItem(new item.ArrowKeys(multi), "arrowKeys", "oc:materialArrowKey")
Recipes.addItemDelegate(new item.NumPad(multi), "numPad", "oc:materialNumPad") Recipes.addItem(new item.NumPad(multi), "numPad", "oc:materialNumPad")
Recipes.addItemDelegate(new item.Transistor(multi), "transistor", "oc:materialTransistor") Recipes.addItem(new item.Transistor(multi), "transistor", "oc:materialTransistor")
Recipes.addItemDelegate(new item.Microchip(multi, 0), "chip1", "oc:circuitChip1") Recipes.addItem(new item.Microchip(multi, 0), "chip1", "oc:circuitChip1")
Recipes.addItemDelegate(new item.Microchip(multi, 1), "chip2", "oc:circuitChip2") Recipes.addItem(new item.Microchip(multi, 1), "chip2", "oc:circuitChip2")
Recipes.addItemDelegate(new item.Microchip(multi, 2), "chip3", "oc:circuitChip3") Recipes.addItem(new item.Microchip(multi, 2), "chip3", "oc:circuitChip3")
Recipes.addItemDelegate(new item.ALU(multi), "alu", "oc:materialALU") Recipes.addItem(new item.ALU(multi), "alu", "oc:materialALU")
Recipes.addItemDelegate(new item.ControlUnit(multi), "cu", "oc:materialCU") Recipes.addItem(new item.ControlUnit(multi), "cu", "oc:materialCU")
Recipes.addItemDelegate(new item.CPU(multi, 0), "cpu1", "oc:cpu1") Recipes.addItem(new item.CPU(multi, 0), "cpu1", "oc:cpu1")
Recipes.addItemDelegate(new item.RawCircuitBoard(multi), "rawCircuitBoard", "oc:materialCircuitBoardRaw") Recipes.addItem(new item.RawCircuitBoard(multi), "rawCircuitBoard", "oc:materialCircuitBoardRaw")
Recipes.addItemDelegate(new item.CircuitBoard(multi), "circuitBoard", "oc:materialCircuitBoard") Recipes.addItem(new item.CircuitBoard(multi), "circuitBoard", "oc:materialCircuitBoard")
Recipes.addItemDelegate(new item.PrintedCircuitBoard(multi), "printedCircuitBoard", "oc:materialCircuitBoardPrinted") Recipes.addItem(new item.PrintedCircuitBoard(multi), "printedCircuitBoard", "oc:materialCircuitBoardPrinted")
Recipes.addItemDelegate(new item.CardBase(multi), "card", "oc:materialCard") Recipes.addItem(new item.CardBase(multi), "card", "oc:materialCard")
// v1.1.0 // v1.1.0
Recipes.addItemDelegate(new item.UpgradeSolarGenerator(multi), "solarGeneratorUpgrade", "oc:solarGeneratorUpgrade") Recipes.addItem(new item.UpgradeSolarGenerator(multi), "solarGeneratorUpgrade", "oc:solarGeneratorUpgrade")
Recipes.addItemDelegate(new item.UpgradeSign(multi), "signUpgrade", "oc:signUpgrade") Recipes.addItem(new item.UpgradeSign(multi), "signUpgrade", "oc:signUpgrade")
Recipes.addItemDelegate(new item.UpgradeNavigation(multi), "navigationUpgrade", "oc:navigationUpgrade") Recipes.addItem(new item.UpgradeNavigation(multi), "navigationUpgrade", "oc:navigationUpgrade")
// Always create, to avoid shifting IDs. // Always create, to avoid shifting IDs.
val abstractBus = new item.AbstractBusCard(multi) val abstractBus = new item.AbstractBusCard(multi)
if (Mods.StargateTech2.isAvailable) { if (Mods.StargateTech2.isAvailable) {
Recipes.addItemDelegate(abstractBus, "abstractBusCard", "oc:abstractBusCard") Recipes.addItem(abstractBus, "abstractBusCard", "oc:abstractBusCard")
} }
Recipes.addItemDelegate(new item.Memory(multi, 4), "ram5", "oc:ram5") Recipes.addItem(new item.Memory(multi, 4), "ram5", "oc:ram5")
Recipes.addItemDelegate(new item.Memory(multi, 5), "ram6", "oc:ram6") Recipes.addItem(new item.Memory(multi, 5), "ram6", "oc:ram6")
// v1.2.0 // v1.2.0
Recipes.addItemDelegate(new item.Server(multi, 2), "server3", "oc:server3") Recipes.addItem(new item.Server(multi, 2), "server3", "oc:server3")
Recipes.addItemDelegate(new item.Terminal(multi), "terminal", "oc:terminal") Recipes.addItem(new item.Terminal(multi), "terminal", "oc:terminal")
Recipes.addItemDelegate(new item.CPU(multi, 1), "cpu2", "oc:cpu2") Recipes.addItem(new item.CPU(multi, 1), "cpu2", "oc:cpu2")
Recipes.addItemDelegate(new item.CPU(multi, 2), "cpu3", "oc:cpu3") Recipes.addItem(new item.CPU(multi, 2), "cpu3", "oc:cpu3")
Recipes.addItemDelegate(new item.InternetCard(multi), "internetCard", "oc:internetCard") Recipes.addItem(new item.InternetCard(multi), "internetCard", "oc:internetCard")
Recipes.addItemDelegate(new item.Server(multi, 0), "server1", "oc:server1") Recipes.addItem(new item.Server(multi, 0), "server1", "oc:server1")
Recipes.addItemDelegate(new item.Server(multi, 1), "server2", "oc:server2") Recipes.addItem(new item.Server(multi, 1), "server2", "oc:server2")
// v1.2.3 // v1.2.3
register(new item.FloppyDisk(multi) { registerItem(new item.FloppyDisk(multi) {
showInItemList = false showInItemList = false
}, "lootDisk") }, "lootDisk")
// v1.2.6 // v1.2.6
Recipes.addItemDelegate(new item.Interweb(multi), "interweb", "oc:materialInterweb") Recipes.addItem(new item.Interweb(multi), "interweb", "oc:materialInterweb")
Recipes.addItemDelegate(new item.UpgradeAngel(multi), "angelUpgrade", "oc:angelUpgrade") Recipes.addItem(new item.UpgradeAngel(multi), "angelUpgrade", "oc:angelUpgrade")
Recipes.addItemDelegate(new item.Memory(multi, 1), "ram2", "oc:ram2") Recipes.addItem(new item.Memory(multi, 1), "ram2", "oc:ram2")
// v1.3.0 // v1.3.0
Recipes.addItemDelegate(new item.LinkedCard(multi), "linkedCard", "oc:linkedCard") Recipes.addItem(new item.LinkedCard(multi), "linkedCard", "oc:linkedCard")
Recipes.addItemDelegate(new item.UpgradeExperience(multi), "experienceUpgrade", "oc:experienceUpgrade") Recipes.addItem(new item.UpgradeExperience(multi), "experienceUpgrade", "oc:experienceUpgrade")
Recipes.addItemDelegate(new item.UpgradeInventory(multi), "inventoryUpgrade", "oc:inventoryUpgrade") Recipes.addItem(new item.UpgradeInventory(multi), "inventoryUpgrade", "oc:inventoryUpgrade")
Recipes.addItemDelegate(new item.UpgradeContainerUpgrade(multi, 0), "upgradeContainer1", "oc:upgradeContainer1") Recipes.addItem(new item.UpgradeContainerUpgrade(multi, 0), "upgradeContainer1", "oc:upgradeContainer1")
Recipes.addItemDelegate(new item.UpgradeContainerUpgrade(multi, 1), "upgradeContainer2", "oc:upgradeContainer2") Recipes.addItem(new item.UpgradeContainerUpgrade(multi, 1), "upgradeContainer2", "oc:upgradeContainer2")
Recipes.addItemDelegate(new item.UpgradeContainerUpgrade(multi, 2), "upgradeContainer3", "oc:upgradeContainer3") Recipes.addItem(new item.UpgradeContainerUpgrade(multi, 2), "upgradeContainer3", "oc:upgradeContainer3")
Recipes.addItemDelegate(new item.UpgradeContainerCard(multi, 0), "cardContainer1", "oc:cardContainer1") Recipes.addItem(new item.UpgradeContainerCard(multi, 0), "cardContainer1", "oc:cardContainer1")
Recipes.addItemDelegate(new item.UpgradeContainerCard(multi, 1), "cardContainer2", "oc:cardContainer2") Recipes.addItem(new item.UpgradeContainerCard(multi, 1), "cardContainer2", "oc:cardContainer2")
Recipes.addItemDelegate(new item.UpgradeContainerCard(multi, 2), "cardContainer3", "oc:cardContainer3") Recipes.addItem(new item.UpgradeContainerCard(multi, 2), "cardContainer3", "oc:cardContainer3")
} }
} }

View File

@ -34,17 +34,10 @@ class Proxy {
registerExclusive("nuggetIron", Items.ironNugget.createItemStack()) registerExclusive("nuggetIron", Items.ironNugget.createItemStack())
if (OreDictionary.getOres("nuggetIron").exists(Items.ironNugget.createItemStack().isItemEqual)) { if (OreDictionary.getOres("nuggetIron").exists(Items.ironNugget.createItemStack().isItemEqual)) {
Recipes.addItemDelegate(Items.ironNugget, "nuggetIron") Recipes.addItem(Items.ironNugget, "nuggetIron")
Recipes.addItem(Item.ingotIron, "ingotIron") Recipes.addItem(Item.ingotIron, "ingotIron")
} }
if (Mods.ForgeMultipart.isAvailable) {
MultiPart.init()
}
if (Mods.ComputerCraft16.isAvailable) {
ComputerCraft16.init()
}
api.CreativeTab.instance = CreativeTab api.CreativeTab.instance = CreativeTab
api.Driver.instance = driver.Registry api.Driver.instance = driver.Registry
api.FileSystem.instance = fs.FileSystem api.FileSystem.instance = fs.FileSystem
@ -54,6 +47,13 @@ class Proxy {
if (LuaStateFactory.isAvailable) classOf[NativeLuaArchitecture] if (LuaStateFactory.isAvailable) classOf[NativeLuaArchitecture]
else classOf[LuaJLuaArchitecture] else classOf[LuaJLuaArchitecture]
api.Network.instance = network.Network api.Network.instance = network.Network
if (Mods.ForgeMultipart.isAvailable) {
MultiPart.init()
}
if (Mods.ComputerCraft16.isAvailable) {
ComputerCraft16.init()
}
} }
def init(e: FMLInitializationEvent) { def init(e: FMLInitializationEvent) {

View File

@ -3,13 +3,13 @@ package li.cil.oc.common.multipart
import codechicken.lib.vec.{Vector3, Cuboid6} import codechicken.lib.vec.{Vector3, Cuboid6}
import codechicken.multipart._ import codechicken.multipart._
import cpw.mods.fml.relauncher.{Side, SideOnly} import cpw.mods.fml.relauncher.{Side, SideOnly}
import li.cil.oc.api.network import li.cil.oc.api.{Items, network}
import li.cil.oc.api.network.{Message, Node, Visibility} import li.cil.oc.api.network.{Message, Node, Visibility}
import li.cil.oc.client.renderer.tileentity.CableRenderer import li.cil.oc.client.renderer.tileentity.CableRenderer
import li.cil.oc.common.block.Cable import li.cil.oc.common.block.{Delegator, Cable}
import li.cil.oc.server.TickHandler import li.cil.oc.server.TickHandler
import li.cil.oc.util.ExtendedNBT._ import li.cil.oc.util.ExtendedNBT._
import li.cil.oc.{Blocks, Settings, api} import li.cil.oc.{Settings, api}
import net.minecraft.nbt.NBTTagCompound import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.AxisAlignedBB import net.minecraft.util.AxisAlignedBB
import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL11
@ -19,7 +19,7 @@ import scala.collection.convert.WrapAsScala._
class CablePart(val original: Option[Node] = None) extends DelegatePart with TCuboidPart with TNormalOcclusion with network.Environment { class CablePart(val original: Option[Node] = None) extends DelegatePart with TCuboidPart with TNormalOcclusion with network.Environment {
val node = api.Network.newNode(this, Visibility.None).create() val node = api.Network.newNode(this, Visibility.None).create()
override def delegate = Blocks.cable override def delegate = Delegator.subBlock(Items.get("cable").createItemStack(1)).get
def getType = Settings.namespace + "cable" def getType = Settings.namespace + "cable"

View File

@ -4,7 +4,6 @@ import codechicken.lib.packet.PacketCustom
import codechicken.lib.raytracer.RayTracer import codechicken.lib.raytracer.RayTracer
import codechicken.lib.vec.{Vector3, BlockCoord} import codechicken.lib.vec.{Vector3, BlockCoord}
import codechicken.multipart.TileMultipart import codechicken.multipart.TileMultipart
import li.cil.oc.Blocks
import li.cil.oc.client.PacketSender import li.cil.oc.client.PacketSender
import li.cil.oc.common.block.Delegator import li.cil.oc.common.block.Delegator
import net.minecraft.block.Block import net.minecraft.block.Block
@ -15,6 +14,7 @@ import net.minecraftforge.common.MinecraftForge
import net.minecraftforge.event.ForgeSubscribe import net.minecraftforge.event.ForgeSubscribe
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action
import net.minecraftforge.event.entity.player.{PlayerDestroyItemEvent, PlayerInteractEvent} import net.minecraftforge.event.entity.player.{PlayerDestroyItemEvent, PlayerInteractEvent}
import li.cil.oc.api.Items
object EventHandler { object EventHandler {
@ForgeSubscribe @ForgeSubscribe
@ -31,7 +31,7 @@ object EventHandler {
val world = player.getEntityWorld val world = player.getEntityWorld
val hit = RayTracer.reTrace(world, player) val hit = RayTracer.reTrace(world, player)
if (hit != null) Delegator.subBlock(player.getHeldItem) match { if (hit != null) Delegator.subBlock(player.getHeldItem) match {
case Some(subBlock) if subBlock == Blocks.cable => placeDelegatePart(player, hit, new CablePart()) case Some(subBlock) if subBlock == Delegator.subBlock(Items.get("cable").createItemStack(1)).get => placeDelegatePart(player, hit, new CablePart())
case _ => false case _ => false
} }
else false else false

View File

@ -4,9 +4,10 @@ import codechicken.lib.vec.BlockCoord
import codechicken.multipart.MultiPartRegistry.{IPartConverter, IPartFactory} import codechicken.multipart.MultiPartRegistry.{IPartConverter, IPartFactory}
import codechicken.multipart.{TMultiPart, MultiPartRegistry} import codechicken.multipart.{TMultiPart, MultiPartRegistry}
import li.cil.oc.common.tileentity.Cable import li.cil.oc.common.tileentity.Cable
import li.cil.oc.{Settings, Blocks} import li.cil.oc.Settings
import net.minecraft.world.World import net.minecraft.world.World
import net.minecraftforge.common.MinecraftForge import net.minecraftforge.common.MinecraftForge
import li.cil.oc.api.Items
object MultiPart extends IPartFactory with IPartConverter { object MultiPart extends IPartFactory with IPartConverter {
def init() { def init() {
@ -22,7 +23,7 @@ object MultiPart extends IPartFactory with IPartConverter {
} }
override def canConvert(blockID: Int): Boolean = { override def canConvert(blockID: Int): Boolean = {
blockID == Blocks.cable.parent.blockID blockID == Items.get("cable").block.blockID
} }
override def convert(world: World, pos: BlockCoord) = { override def convert(world: World, pos: BlockCoord) = {

View File

@ -20,22 +20,22 @@ import scala.collection.mutable
object Recipes { object Recipes {
val list = mutable.LinkedHashMap.empty[ItemStack, String] val list = mutable.LinkedHashMap.empty[ItemStack, String]
def addBlockDelegate[T <: common.block.Delegate](delegate: T, name: String, oreDict: String = null) = { def addBlock[T <: common.block.Delegate](delegate: T, name: String, oreDict: String = null) = {
Items.register(delegate, name) Items.registerBlock(delegate, name)
list += delegate.createItemStack() -> name list += delegate.createItemStack() -> name
register(oreDict, delegate.createItemStack()) register(oreDict, delegate.createItemStack())
delegate delegate
} }
def addItemDelegate[T <: common.item.Delegate](delegate: T, name: String, oreDict: String = null) = { def addItem[T <: common.item.Delegate](delegate: T, name: String, oreDict: String = null) = {
Items.register(delegate, name) Items.registerItem(delegate, name)
list += delegate.createItemStack() -> name list += delegate.createItemStack() -> name
register(oreDict, delegate.createItemStack()) register(oreDict, delegate.createItemStack())
delegate delegate
} }
def addItem(instance: Item, name: String) = { def addItem(instance: Item, name: String) = {
Items.register(instance, name) Items.registerItem(instance, name)
list += new ItemStack(instance) -> name list += new ItemStack(instance) -> name
instance instance
} }

View File

@ -46,7 +46,7 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
private val signals = mutable.Queue.empty[Machine.Signal] private val signals = mutable.Queue.empty[Machine.Signal]
private val callCounts = mutable.Map.empty[String, mutable.Map[String, Int]] private val callCounts = mutable.Map.empty[Any, mutable.Map[String, Int]]
// ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- //
@ -240,9 +240,14 @@ class Machine(val owner: Owner, constructor: Constructor[_ <: Architecture]) ext
override def invoke(value: Value, method: String, args: Array[AnyRef]): Array[AnyRef] = Callbacks(value).get(method) match { override def invoke(value: Value, method: String, args: Array[AnyRef]): Array[AnyRef] = Callbacks(value).get(method) match {
case Some(callback) => case Some(callback) =>
val direct = callback.direct val direct = callback.direct
if (direct && architecture.isInitialized) { if (direct && architecture.isInitialized) callCounts.synchronized {
val limit = callback.limit val limit = callback.limit
// TODO callcount limit val counts = callCounts.getOrElseUpdate(value, mutable.Map.empty[String, Int])
val count = counts.getOrElseUpdate(method, 0)
if (count >= limit) {
throw new LimitReachedException()
}
counts(method) += 1
} }
Registry.convert(callback(value, this, new ArgumentsImpl(Seq(args: _*)))) Registry.convert(callback(value, this, new ArgumentsImpl(Seq(args: _*))))
case _ => throw new NoSuchMethodException() case _ => throw new NoSuchMethodException()

View File

@ -4,7 +4,7 @@ import java.lang.reflect.{InvocationTargetException, Method, Modifier}
import li.cil.oc.api.driver.MethodWhitelist import li.cil.oc.api.driver.MethodWhitelist
import li.cil.oc.api.machine.Robot import li.cil.oc.api.machine.Robot
import li.cil.oc.api.network import li.cil.oc.api.network
import li.cil.oc.api.network.{Environment, Context, ManagedPeripheral} import li.cil.oc.api.network.{Context, ManagedPeripheral}
import li.cil.oc.OpenComputers import li.cil.oc.OpenComputers
import li.cil.oc.server.driver.CompoundBlockEnvironment import li.cil.oc.server.driver.CompoundBlockEnvironment
import scala.collection.{immutable, mutable} import scala.collection.{immutable, mutable}

View File

@ -48,7 +48,7 @@ object ItemCosts {
def hasCosts(stack: ItemStack) = { def hasCosts(stack: ItemStack) = {
val ingredients = computeIngredients(stack) val ingredients = computeIngredients(stack)
ingredients.size > 0 && (ingredients.size > 1 || !ItemStack.areItemStacksEqual(ingredients.head._1, stack)) ingredients.size > 0 && (ingredients.size > 1 || !ingredients.head._1.isItemEqual(stack))
} }
def addTooltip(stack: ItemStack, tooltip: util.List[String]) { def addTooltip(stack: ItemStack, tooltip: util.List[String]) {

View File

@ -69,7 +69,7 @@ object ItemUtils {
api.Items.get("keyboard").createItemStack(1), api.Items.get("keyboard").createItemStack(1),
api.Items.get("inventoryUpgrade").createItemStack(1), api.Items.get("inventoryUpgrade").createItemStack(1),
api.Items.get("experienceUpgrade").createItemStack(1), api.Items.get("experienceUpgrade").createItemStack(1),
api.Items.get("gpu1").createItemStack(1), api.Items.get("graphicsCard1").createItemStack(1),
api.Items.get("cpu1").createItemStack(1), api.Items.get("cpu1").createItemStack(1),
api.Items.get("ram2").createItemStack(1) api.Items.get("ram2").createItemStack(1)
) )