From 01304bf734e445f85cfbb21b5410344f49dab0b7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 25 Nov 2019 18:41:09 -0500 Subject: [PATCH] Fixed bizzare crash --- .../mindustry/entities/traits/BuilderTrait.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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()}; }