It's a kind of a 3D grid made of triggers and collisions. When placing a block in the grid we use a "virtual copy" aligned in the grid. We use this copy to check for the correct final placement of the block.
Bear in mind this prototype has been made in just a few weeks so it might not be the best way to achieve this.