fixed robots not storing their orientation. and redstone output. since the the save code cleanup. herp derp.

This commit is contained in:
Florian Nücke 2014-01-31 00:17:25 +01:00
parent e03bede4c3
commit ef665390b4
4 changed files with 23 additions and 29 deletions

View File

@ -19,11 +19,11 @@ import scala.Array
))
trait BundledRedstoneAware extends RedstoneAware with IBundledEmitter with IBundledUpdatable with IBundledTile {
private val _bundledInput = Array.fill(6)(Array.fill(16)(-1))
protected[tileentity] val _bundledInput = Array.fill(6)(Array.fill(16)(-1))
private val _rednetInput = Array.fill(6)(Array.fill(16)(-1))
protected[tileentity] val _rednetInput = Array.fill(6)(Array.fill(16)(-1))
private val _bundledOutput = Array.fill(6)(Array.fill(16)(0))
protected[tileentity] val _bundledOutput = Array.fill(6)(Array.fill(16)(0))
// ----------------------------------------------------------------------- //

View File

@ -15,9 +15,9 @@ import net.minecraftforge.common.ForgeDirection
new Optional.Interface(iface = "mods.immibis.redlogic.api.wiring.IRedstoneUpdatable", modid = "RedLogic")
))
trait RedstoneAware extends RotationAware with IConnectable with IRedstoneEmitter with IRedstoneUpdatable {
protected val _input = Array.fill(6)(-1)
protected[tileentity] val _input = Array.fill(6)(-1)
protected val _output = Array.fill(6)(0)
protected[tileentity] val _output = Array.fill(6)(0)
protected var _isOutputEnabled = false

View File

@ -134,26 +134,20 @@ class RobotProxy(val robot: Robot) extends Computer(robot.isClient) with ISidedI
// ----------------------------------------------------------------------- //
override protected[tileentity] val _input = robot._input
override protected[tileentity] val _output = robot._output
override protected[tileentity] val _bundledInput = robot._bundledInput
override protected[tileentity] val _rednetInput = robot._rednetInput
override protected[tileentity] val _bundledOutput = robot._bundledOutput
override def isOutputEnabled = robot.isOutputEnabled
override def isOutputEnabled_=(value: Boolean) = robot.isOutputEnabled_=(value)
override def input(side: ForgeDirection) = robot.input(side)
override def output(side: ForgeDirection) = robot.output(side)
override def output(side: ForgeDirection, value: Int) = robot.output(side, value)
override def bundledInput(side: ForgeDirection, color: Int) = robot.bundledInput(side, color)
override def rednetInput(side: ForgeDirection, color: Int, value: Int) = robot.rednetInput(side, color, value)
override def bundledOutput(side: ForgeDirection) = robot.bundledOutput(side)
override def bundledOutput(side: ForgeDirection, color: Int) = robot.bundledOutput(side, color)
override def bundledOutput(side: ForgeDirection, color: Int, value: Int) = robot.bundledOutput(side, color, value)
override def checkRedstoneInputChanged() = robot.checkRedstoneInputChanged()
override def updateRedstoneInput() = robot.updateRedstoneInput()

View File

@ -164,31 +164,31 @@ trait Rotatable extends RotationAware with api.Rotatable {
override def readFromNBT(nbt: NBTTagCompound) = {
super.readFromNBT(nbt)
_pitch = ForgeDirection.getOrientation(nbt.getInteger(Settings.namespace + "pitch"))
_yaw = ForgeDirection.getOrientation(nbt.getInteger(Settings.namespace + "yaw"))
pitch = ForgeDirection.getOrientation(nbt.getInteger(Settings.namespace + "pitch"))
yaw = ForgeDirection.getOrientation(nbt.getInteger(Settings.namespace + "yaw"))
validatePitchAndYaw()
updateTranslation()
}
override def writeToNBT(nbt: NBTTagCompound) = {
super.writeToNBT(nbt)
nbt.setInteger(Settings.namespace + "pitch", _pitch.ordinal)
nbt.setInteger(Settings.namespace + "yaw", _yaw.ordinal)
nbt.setInteger(Settings.namespace + "pitch", pitch.ordinal)
nbt.setInteger(Settings.namespace + "yaw", yaw.ordinal)
}
@SideOnly(Side.CLIENT)
override def readFromNBTForClient(nbt: NBTTagCompound) {
super.readFromNBTForClient(nbt)
_pitch = ForgeDirection.getOrientation(nbt.getInteger("pitch"))
_yaw = ForgeDirection.getOrientation(nbt.getInteger("yaw"))
pitch = ForgeDirection.getOrientation(nbt.getInteger("pitch"))
yaw = ForgeDirection.getOrientation(nbt.getInteger("yaw"))
validatePitchAndYaw()
updateTranslation()
}
override def writeToNBTForClient(nbt: NBTTagCompound) {
super.writeToNBTForClient(nbt)
nbt.setInteger("pitch", _pitch.ordinal)
nbt.setInteger("yaw", _yaw.ordinal)
nbt.setInteger("pitch", pitch.ordinal)
nbt.setInteger("yaw", yaw.ordinal)
}
private def validatePitchAndYaw() {