localized names and tooltips for redstone block; recipe for redstone block and adjusted some other recipes to be more... uniform (e.g. router to have card in mid, cables as "connectors" - was too expensive before, for what it does); fixed redstone block not saving its node address; fixed possible crash if server thread update checked computer state while that state was being modified (and the stack was empty)

This commit is contained in:
Florian Nücke 2013-12-12 02:11:30 +01:00
parent 91219b594a
commit 6c8210b5eb
7 changed files with 65 additions and 33 deletions

View File

@ -10,6 +10,7 @@ oc:block.DiskDrive.name=Diskettenlaufwerk
oc:block.Keyboard.name=Tastatur
oc:block.PowerConverter.name=Leistungswandler
oc:block.PowerDistributor.name=Stromverteiler
oc:block.Redstone.name=Redstone E/A
oc:block.Robot.name=Roboter
oc:block.RobotAfterimage.name=Roboter
oc:block.Router.name=Router
@ -98,8 +99,9 @@ oc:tooltip.PowerConverter=Wandelt Strom anderer Mods in den internen Energietyp
oc:tooltip.PowerDistributor=Verteilt Energie zwischen mehreren Netwerken. Nützlich um Energie mit einem Wandler auf mehrere Subnetze, die voneinander getrennt sein sollen, zu verteilen.
oc:tooltip.PrintedCircuitBoard=Hierauf basieren alle alle Erweiterungskarten, Speicher und so weiter.
oc:tooltip.RawCircuitBoard=Kann in einer Ofenkompatiblen Schmelze freier Wahl gehärtet werden.
oc:tooltip.RedstoneCard.RedLogic=RedLogic wird §aunterstützt§7.
oc:tooltip.RedstoneCard.RedNet=RedNet wird §aunterstützt§7.
oc:tooltip.Redstone=Erlaubt das Lesen und Ausgeben von Redstonesignalen um den Block herum. Kann von jedem Computer der mit dem Block verbunden ist gesteuert werden. Dieser Block ist quasi wie eine externe Redstonekarte.
oc:tooltip.RedstoneCard.RedLogic=§fRedLogic§7 wird §aunterstützt§7.
oc:tooltip.RedstoneCard.RedNet=§fRedNet§7 wird §aunterstützt§7.
oc:tooltip.RedstoneCard=Erlaubt das Lesen und Ausgeben von Redstonesignalen um den Computer oder Roboter herum.
oc:tooltip.Robot=Im Gegensatz zu normalen Computern können sich Roboter in der Welt bewegen und ähnlich wie Spieler mit der Welt interagieren. Sie können jedoch §onicht§r§7 mit externen Komponenten interagieren!
oc:tooltip.Robot_Level=§fStufe§7: §a%s§7.

View File

@ -14,6 +14,7 @@ oc:block.DiskDrive.name=Disk Drive
oc:block.Keyboard.name=Keyboard
oc:block.PowerConverter.name=Power Converter
oc:block.PowerDistributor.name=Power Distributor
oc:block.Redstone.name=Redstone I/O
oc:block.Robot.name=Robot
oc:block.RobotAfterimage.name=Robot
oc:block.Router.name=Router
@ -103,8 +104,9 @@ oc:tooltip.PowerConverter=Converts power from other mods to the internal energy
oc:tooltip.PowerDistributor=Distributes energy among different networks. This is useful for sharing power fed into your system from one converter among different sub-networks that should remain separate.
oc:tooltip.PrintedCircuitBoard=The basic building block for expansion cards and memory and such.
oc:tooltip.RawCircuitBoard=Can be hardened in any furnace compatible oven.
oc:tooltip.RedstoneCard.RedLogic=RedLogic is §asupported§7.
oc:tooltip.RedstoneCard.RedNet=RedNet is §asupported§7.
oc:tooltip.Redstone=Allows reading and emitting redstone signals around the block. Can be controlled by any computer the block is connected to. This is basically like an external redstone card.
oc:tooltip.RedstoneCard.RedLogic=§fRedLogic§7 is §asupported§7.
oc:tooltip.RedstoneCard.RedNet=§fRedNet§7 is §asupported§7.
oc:tooltip.RedstoneCard=Allows reading and emitting redstone signals around the computer or robot.
oc:tooltip.Robot=Unlike computers, robots can move around and interact with the world much like a player can. They can §onot§r§7 interact with external components, however!
# The underscore makes sure this isn't hidden with the rest of the tooltip.

View File

@ -32,6 +32,7 @@ object Recipes {
val obsidian = new ItemStack(Block.obsidian)
val paper = new ItemStack(Item.paper)
val piston = new ItemStack(Block.pistonBase)
val redstoneBlock = new ItemStack(Block.blockRedstone)
val redstoneDust = new ItemStack(Item.redstone)
val redstoneTorch = new ItemStack(Block.torchRedstoneActive)
val repeater = new ItemStack(Item.redstoneRepeater)
@ -254,16 +255,6 @@ object Recipes {
'p', paper,
'b', pcb)
addRecipe(Blocks.powerDistributor.createItemStack(),
"ici",
"wgw",
"ibi",
'i', ironIngot,
'c', chip1,
'w', cable,
'g', goldIngot,
'b', pcb)
addRecipe(Blocks.powerConverter.createItemStack(),
"iwi",
"gcg",
@ -283,15 +274,6 @@ object Recipes {
'p', piston,
's', stick)
addRecipe(Blocks.router.createItemStack(),
"ini",
"ncn",
"ibi",
'i', ironIngot,
'n', lanCard,
'c', chip1,
'b', pcb)
addRecipe(Blocks.adapter.createItemStack(),
"iwi",
"wcw",
@ -301,6 +283,34 @@ object Recipes {
'c', chip1,
'b', pcb)
addRecipe(Blocks.redstone.createItemStack(),
"iri",
"rcr",
"ibi",
'i', ironIngot,
'r', redstoneBlock,
'c', redstoneCard,
'b', pcb)
addRecipe(Blocks.powerDistributor.createItemStack(),
"igi",
"wcw",
"ibi",
'i', ironIngot,
'g', goldIngot,
'w', cable,
'c', chip1,
'b', pcb)
addRecipe(Blocks.router.createItemStack(),
"iwi",
"wnw",
"ibi",
'i', ironIngot,
'w', cable,
'n', lanCard,
'b', pcb)
addRecipe(Blocks.charger.createItemStack(),
"igi",
"pcp",

View File

@ -1,9 +1,10 @@
package li.cil.oc.common.block
import cpw.mods.fml.common.Loader
import java.util
import li.cil.oc.Settings
import li.cil.oc.common.tileentity
import li.cil.oc.util.Tooltip
import li.cil.oc.{Items, Settings}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
@ -18,6 +19,12 @@ class Redstone(val parent: SimpleDelegator) extends RedstoneAware with SimpleDel
override def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: util.List[String], advanced: Boolean) {
tooltip.addAll(Tooltip.get(unlocalizedName))
if (Loader.isModLoaded("RedLogic")) {
tooltip.addAll(Tooltip.get(Items.rs.unlocalizedName + ".RedLogic"))
}
if (Loader.isModLoaded("MineFactoryReloaded")) {
tooltip.addAll(Tooltip.get(Items.rs.unlocalizedName + ".RedNet"))
}
}
override def icon(side: ForgeDirection) = Some(icons(side.ordinal()))

View File

@ -99,16 +99,12 @@ abstract class Computer(isRemote: Boolean) extends Environment with ComponentInv
override def readFromNBT(nbt: NBTTagCompound) {
super.readFromNBT(nbt)
if (isServer) {
computer.load(nbt.getCompoundTag(Settings.namespace + "computer"))
}
computer.load(nbt.getCompoundTag(Settings.namespace + "computer"))
}
override def writeToNBT(nbt: NBTTagCompound) {
super.writeToNBT(nbt)
if (isServer) {
nbt.setNewCompoundTag(Settings.namespace + "computer", computer.save)
}
nbt.setNewCompoundTag(Settings.namespace + "computer", computer.save)
}
@SideOnly(Side.CLIENT)

View File

@ -1,23 +1,38 @@
package li.cil.oc.common.tileentity
import li.cil.oc.Settings
import li.cil.oc.api.network.Visibility
import li.cil.oc.server.component
import li.cil.oc.util.ExtendedNBT._
import li.cil.oc.util.mods.BundledRedstone
import net.minecraft.nbt.NBTTagCompound
import net.minecraftforge.common.ForgeDirection
class Redstone extends Environment with BundledRedstoneAware {
val instance = if (BundledRedstone.isAvailable) new component.BundledRedstone(this) else new component.Redstone(this)
val node = instance.node
if (node != null) node.setVisibility(Visibility.Network)
if (node != null) {
node.setVisibility(Visibility.Network)
_isOutputEnabled = true
}
override def updateEntity() {
super.updateEntity()
if (isServer) {
isOutputEnabled = true
updateRedstoneInput()
}
}
override def readFromNBT(nbt: NBTTagCompound) {
super.readFromNBT(nbt)
instance.load(nbt.getCompoundTag(Settings.namespace + "redstone"))
}
override def writeToNBT(nbt: NBTTagCompound) {
super.writeToNBT(nbt)
nbt.setNewCompoundTag(Settings.namespace + "redstone", instance.save)
}
override protected def onRedstoneInputChanged(side: ForgeDirection) {
super.onRedstoneInputChanged(side)
node.sendToReachable("computer.signal", "redstone_changed", Int.box(side.ordinal()))

View File

@ -202,7 +202,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con
override val canUpdate = true
override def update() = if (state.top != Computer.State.Stopped) {
override def update() = if (state.synchronized(state.top != Computer.State.Stopped)) {
// Add components that were added since the last update to the actual list
// of components if we can see them. We use this delayed approach to avoid
// issues with components that have a visibility lower than their