diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index 8c332547a2..b2f4ee4760 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -537,27 +537,23 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ } final int[] i = {0}; - final Array chain = new Array(); lineRequests.each(req -> { if(!(req.block instanceof PowerNode)) return; if(i[0]++ == 0 || i[0] == lineRequests.size){ // beginning & end should always be placed }else{ - final boolean[] overlaps = {false}; - chain.each(tile -> { - if(((PowerNode) req.block).overlaps(req.tile(), tile)){ - overlaps[0] = true; - }; - }); + int overlaps = 0; + for(int j = 0; j < i[0]; j++){ + if (((PowerNode) req.block).overlaps(lineRequests.get(i[0]).tile(), lineRequests.get(j).tile()) && lineRequests.get(j).block instanceof PowerNode){ + overlaps++; + } + } - if(overlaps[0]){ + if(overlaps > 1){ req.block = Blocks.air; - return; } } - - chain.add(req.tile()); }); }