diff --git a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java index 8cde4852c7..3459e3b18e 100644 --- a/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java +++ b/core/src/io/anuke/mindustry/entities/traits/BuilderTrait.java @@ -35,14 +35,14 @@ public interface BuilderTrait extends Entity, TeamTrait{ float finalPlaceDst = state.rules.infiniteResources ? Float.MAX_VALUE : placeDistance; Unit unit = (Unit)this; - //remove already completed build requests - removal.clear(); - removal.addAll(buildQueue()); - - Structs.filter(buildQueue(), req -> { + Iterator it = buildQueue().iterator(); + while(it.hasNext()){ + BuildRequest req = it.next(); Tile tile = world.tile(req.x, req.y); - return tile == null || (req.breaking && tile.block() == Blocks.air) || (!req.breaking && (tile.rotation() == req.rotation || !req.block.rotate) && tile.block() == req.block); - }); + if(tile == null || (req.breaking && tile.block() == Blocks.air) || (!req.breaking && (tile.rotation() == req.rotation || !req.block.rotate) && tile.block() == req.block)){ + it.remove(); + } + } TileEntity core = unit.getClosestCore(); @@ -230,7 +230,6 @@ public interface BuilderTrait extends Entity, TeamTrait{ //due to iOS weirdness, this is apparently required class BuildDataStatic{ - static Array removal = new Array<>(); static Vector2[] tmptr = new Vector2[]{new Vector2(), new Vector2(), new Vector2(), new Vector2()}; }