diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 80295854cf..c75acd047d 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -237,11 +237,14 @@ public class PowerNode extends PowerBlock{ } var worldRange = laserRange * tilesize; - team.data().buildingTree.intersect(tile.worldx() - worldRange, tile.worldy() - worldRange, worldRange * 2, worldRange * 2, build -> { - if(valid.get(build) && !tempBuilds.contains(build)){ - tempBuilds.add(build); - } - }); + var tree = team.data().buildingTree; + if(tree != null){ + tree.intersect(tile.worldx() - worldRange, tile.worldy() - worldRange, worldRange * 2, worldRange * 2, build -> { + if(valid.get(build) && !tempBuilds.contains(build)){ + tempBuilds.add(build); + } + }); + } tempBuilds.sort((a, b) -> { int type = -Boolean.compare(a.block instanceof PowerNode, b.block instanceof PowerNode); @@ -290,11 +293,14 @@ public class PowerNode extends PowerBlock{ } var rangeWorld = maxRange * tilesize; - team.data().buildingTree.intersect(tile.worldx() - rangeWorld, tile.worldy() - rangeWorld, rangeWorld * 2, rangeWorld * 2, build -> { - if(valid.get(build) && !tempBuilds.contains(build)){ - tempBuilds.add(build); - } - }); + var tree = team.data().buildingTree; + if(tree != null){ + tree.intersect(tile.worldx() - rangeWorld, tile.worldy() - rangeWorld, rangeWorld * 2, rangeWorld * 2, build -> { + if(valid.get(build) && !tempBuilds.contains(build)){ + tempBuilds.add(build); + } + }); + } tempBuilds.sort((a, b) -> { int type = -Boolean.compare(a.block instanceof PowerNode, b.block instanceof PowerNode);