From 308219b68be2e7dcca665b789eadaf1b1e701586 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 8 Oct 2022 16:29:29 -0400 Subject: [PATCH] Fixed #7677 --- .../world/blocks/power/PowerNode.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) 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);