Properly send error state to newly connected clients.

This commit is contained in:
Florian Nücke 2015-10-16 20:48:37 +02:00
parent 34eab8a5e0
commit e47cc37d38

View File

@ -413,6 +413,8 @@ class ServerRack extends traits.PowerAcceptor with traits.Hub with traits.PowerB
super.readFromNBTForClient(nbt)
val isRunningNbt = nbt.getBooleanArray("isServerRunning")
Array.copy(isRunningNbt, 0, _isRunning, 0, math.min(isRunningNbt.length, _isRunning.length))
val hasErroredNbt = nbt.getBooleanArray("hasServerErrored")
Array.copy(hasErroredNbt, 0, _hasErrored, 0, math.min(hasErroredNbt.length, _hasErrored.length))
val isPresentNbt = nbt.getTagList("isPresent", NBT.TAG_STRING).map((tag: NBTTagString) => {
val value = tag.func_150285_a_()
if (Strings.isNullOrEmpty(value)) None else Some(value)
@ -435,6 +437,7 @@ class ServerRack extends traits.PowerAcceptor with traits.Hub with traits.PowerB
override def writeToNBTForClient(nbt: NBTTagCompound) {
super.writeToNBTForClient(nbt)
nbt.setBooleanArray("isServerRunning", _isRunning)
nbt.setBooleanArray("hasServerErrored", _hasErrored)
nbt.setNewTagList("isPresent", servers.map(value => new NBTTagString(value.fold("")(_.machine.node.address))))
nbt.setByteArray("sides", sides.map {
case Some(side) => side.ordinal.toByte