fixed dynamic component adding/removal when dynamically changing visibility of components

This commit is contained in:
Florian Nücke 2013-12-08 15:09:10 +01:00
parent 1b15f89498
commit 8c948098d8
2 changed files with 6 additions and 6 deletions

View File

@ -180,9 +180,9 @@ class Screen(var tier: Int) extends Buffer with SidedEnvironment with Rotatable
if (isServer) { if (isServer) {
screen.buffer.node.setVisibility(Visibility.None) screen.buffer.node.setVisibility(Visibility.None)
} }
val s = screen.buffer val buffer = screen.buffer
val (w, h) = s.resolution val (w, h) = buffer.resolution
s.buffer.fill(0, 0, w, h, ' ') buffer.buffer.fill(0, 0, w, h, ' ')
} }
) )
} }

View File

@ -5,7 +5,7 @@ import cpw.mods.fml.relauncher.Side
import java.lang.reflect.{Method, InvocationTargetException} import java.lang.reflect.{Method, InvocationTargetException}
import li.cil.oc.api import li.cil.oc.api
import li.cil.oc.api.network._ import li.cil.oc.api.network._
import li.cil.oc.common.tileentity import li.cil.oc.server.component
import li.cil.oc.util.Persistable import li.cil.oc.util.Persistable
import net.minecraft.nbt.NBTTagCompound import net.minecraft.nbt.NBTTagCompound
import scala.Some import scala.Some
@ -58,12 +58,12 @@ trait Component extends api.network.Component with Persistable {
} }
private def addTo(nodes: Iterable[api.network.Node]) = nodes.foreach(_.host match { private def addTo(nodes: Iterable[api.network.Node]) = nodes.foreach(_.host match {
case computer: tileentity.Computer => computer.computer.addComponent(this) case computer: component.Computer => computer.addComponent(this)
case _ => case _ =>
}) })
private def removeFrom(nodes: Iterable[api.network.Node]) = nodes.foreach(_.host match { private def removeFrom(nodes: Iterable[api.network.Node]) = nodes.foreach(_.host match {
case computer: tileentity.Computer => computer.computer.removeComponent(this) case computer: component.Computer => computer.removeComponent(this)
case _ => case _ =>
}) })