From 5660bfc28d410e816aa8cd7f4a7e16f11c979477 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 3 Jun 2020 01:49:54 +0200 Subject: [PATCH] Fix connected blocks not being detected in prefabs Apparently they're processed, unlike in my save --- GamecraftModdingAPI/Blocks/BlockEngine.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/GamecraftModdingAPI/Blocks/BlockEngine.cs b/GamecraftModdingAPI/Blocks/BlockEngine.cs index 6b412a7..a2fdc51 100644 --- a/GamecraftModdingAPI/Blocks/BlockEngine.cs +++ b/GamecraftModdingAPI/Blocks/BlockEngine.cs @@ -39,11 +39,17 @@ namespace GamecraftModdingAPI.Blocks { if (!BlockExists(blockID)) return new Block[0]; Stack cubeStack = new Stack(); - FasterList cubesToProcess = new FasterList(); - ConnectedCubesUtility.TreeTraversal.GetConnectedCubes(entitiesDB, blockID.entityID, cubeStack, cubesToProcess, (in GridConnectionsEntityStruct g) => { return false; }); - var ret = new Block[cubesToProcess.count]; - for (int i = 0; i < cubesToProcess.count; i++) - ret[i] = new Block(cubesToProcess[i]); + FasterList cubes = new FasterList(10); + var coll = entitiesDB.QueryEntities(CommonExclusiveGroups + .OWNED_BLOCKS_GROUP); + for (int i = 0; i < coll.count; i++) + coll[i].isProcessed = false; + + ConnectedCubesUtility.TreeTraversal.GetConnectedCubes(entitiesDB, blockID.entityID, cubeStack, cubes, (in GridConnectionsEntityStruct g) => { return false; }); + + var ret = new Block[cubes.count]; + for (int i = 0; i < cubes.count; i++) + ret[i] = new Block(cubes[i]); return ret; }