BlockCompressor

Compresses a flat list of block entries into connected regions using BFS.

Groups blocks by type, finds connected components (6-neighbor adjacency), and reports each component as either a single block or a bounding-box region.

Types

Link copied to clipboard
data class BlockPosition(val x: Int, val y: Int, val z: Int)

An integer 3D position.

Link copied to clipboard
data class BlockRegion(val startX: Int, val startY: Int, val startZ: Int, val endX: Int, val endY: Int, val endZ: Int)

An axis-aligned bounding box defined by two corners (min/max are normalized).

Functions

Link copied to clipboard
fun compressBlocks(blockList: List<JsonObject>): JsonObject

Compresses a list of block JSON objects (each with x, y, z, type fields) into a JSON object with a blocks array of compressed entries.