mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -04:00
Should fix a reported NPE in server racks.
This commit is contained in:
parent
fc16ceb935
commit
0e5f320a47
@ -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
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user