Should fix a reported NPE in server racks.

This commit is contained in:
Florian Nücke 2014-07-05 22:06:14 +02:00
parent fc16ceb935
commit 0e5f320a47
2 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,8 @@ class PowerDistributor extends traits.Environment with traits.PowerBalancer with
withConnector(Settings.get.bufferDistributor).
create())
override protected def isConnected = nodes.exists(node => node.address != null && node.network != null)
override def canUpdate = isServer
// ----------------------------------------------------------------------- //

View File

@ -7,9 +7,11 @@ import net.minecraftforge.common.ForgeDirection
trait PowerBalancer extends PowerInformation with SidedEnvironment {
var globalBuffer, globalBufferSize = 0.0
protected def isConnected: Boolean
override def updateEntity() {
super.updateEntity()
if (isServer && world.getWorldTime % Settings.get.tickFrequency == 0) {
if (isServer && isConnected && world.getWorldTime % Settings.get.tickFrequency == 0) {
val nodes = connectors
def network(connector: Connector) = if (connector != null && connector.network != null) connector.network else this
// Yeeeeah, so that just happened... it's not a beauty, but it works. This