blob: 7d26c1efb3b2c15a446e7abdd8efd698e8dd3ddc [file] [log] [blame] [raw]
package li.cil.oc.server.component
import net.minecraftforge.common.ForgeDirection
trait RedstoneEnabled {
protected val _output = Array.fill(6)(0)
def input(side: ForgeDirection): Int
def output = _outputAccess
/** Avoid reflective access. */
class OutputAccess(val parent: RedstoneEnabled) {
def apply(side: ForgeDirection) = parent._output(side.ordinal)
def update(side: ForgeDirection, value: Int) = parent._output(side.ordinal) = value
}
private val _outputAccess = new OutputAccess(this)
}