Region objects also provide the following helpers:
| Method | Behavior |
|---|---|
region:size() | Returns inclusive X, Y and Z sizes. |
region:volume() | Returns the number of block positions in the region. |
region:center() | Returns (min + max + 1) / 2 for each axis. |
region:intersects(other) | Checks whether two region bounds overlap. |
region:expand(n [, ny [, nz]]) | Returns a new region expanded by the supplied distances. |
region:entities([kind]) | Returns entities within the region, optionally filtered by kind. |
region:replace(fromId, toId [, metadata]) | Replaces matching blocks in the region. |
region:each(callback) | Calls the callback with coordinates and block data for each position. Returning false stops iteration. |
region:toTable() | Returns a table containing minX/minY/minZ and maxX/maxY/maxZ. |