public static List <BlockSide> GetConnectedBlocks(Vector3Int centerBlock, string blockType, IConnectedBlockCalculationType calculationType) { List <BlockSide> connectedBlocks = new List <BlockSide>(); foreach (var block in calculationType.AvailableBlockSides) { if (World.TryGetTypeAt(centerBlock.GetBlockOffset(block), out ItemTypes.ItemType blockAtLocation) && ItemCache.CSItems.TryGetValue(blockAtLocation.Name, out var existingBlockType) && string.Equals(existingBlockType?.ConnectedBlock?.BlockType, blockType, StringComparison.InvariantCultureIgnoreCase)) { connectedBlocks.Add(block); } } connectedBlocks.Sort(); return(connectedBlocks); }