So I want to store all blocks in an area, is there some algorithm out there which accomplishes this. I could simply store a list of all blocks, but my concern is this would take up quite some memory, and I'd rather use some cpu to calculate if a block is inside a smaller cuboid. I have made a diagram for better explaining. So I have painted a single iteration of my idea, You go from up left to down right. Creating a cuboid of biggest possible area each time. This way I can reduce my original 77 blocks down to just the two outer ones of a cuboid, 2x9 = 18 coordinates. Everything else would be calculating if a block is inside on of these cuboid, EG: the two locations in the cuboid. My problem is if I know where the uppermost left block is no problem, but what if I want to start from S2 instead of S1? Im sure many people have created such algorithms, is there a better more optimized version of my idea?