Fixed inactive nodes taking energy.

This commit is contained in:
raoulvdberge
2018-06-28 22:54:22 +02:00
parent 6d36071c14
commit a24de5623d

View File

@@ -602,7 +602,11 @@ public class TileController extends TileBase implements ITickable, INetwork, IRe
public int getEnergyUsage() { public int getEnergyUsage() {
int usage = RS.INSTANCE.config.controllerBaseUsage; int usage = RS.INSTANCE.config.controllerBaseUsage;
usage += nodeGraph.all().stream().mapToInt(INetworkNode::getEnergyUsage).sum(); for (INetworkNode node : nodeGraph.all()) {
if (node.canUpdate()) {
usage += node.getEnergyUsage();
}
}
return usage; return usage;
} }
@@ -641,7 +645,7 @@ public class TileController extends TileBase implements ITickable, INetwork, IRe
if (type == null) { if (type == null) {
IBlockState state = world.getBlockState(pos); IBlockState state = world.getBlockState(pos);
if (state.getBlock() == RSBlocks.CONTROLLER) { if (state.getBlock() == RSBlocks.CONTROLLER) {
this.type = (ControllerType) state.getValue(BlockController.TYPE); this.type = (ControllerType) state.getValue(BlockController.TYPE);
} }
} }