Defining Regions
First of all, region coordinates in PGM are real numbers.
That means they can be fractional values, like 2.3
, 4.5
, 6.789
, and so on.
A coordinate represents a point on one of the three axes (X, Y, or Z), and a set of three coordinates represents a point in 3D space.
Coordinates do not represent blocks, at least not directly.
When PGM needs to decide if a block is inside a region, it checks if the point at the center of the block is inside the region.
The center point of a block will always have coordinates that end in 0.5
.
When making regions, you have to make sure that all the block centers are inside the region.
Cuboid
Here is an example. Let us say we want to make a region for a destroyable monument that looks like this:
First, we stand very close to one corner of the region and note the coordinates are (32, 60, -20)
:
Then, we stand over the opposite corner and note the coordinates are (34, 60, -18)
.
We know the monument is three blocks tall, so we will just subtract 3 from the Y coordinate to get (34, 57, -18)
:
Notice that we are rounding to the nearest integer, since those will be the coordinates of the corner we are standing close to. We do not need to worry about positive vs negative coordinates, as they work the same way, and we never need to add or subtract one.
With these coordinates, we can make a cuboid region for the monument:
<cuboid min="32,60,-20" max="34,57,-18"/>
For style points, we can make sure all the low coordinates are in min
and the high ones in max
:
<cuboid min="32,57,-20" max="34,60,-18"/>
This is not necessary, as PGM will fix it for you, but it might make the XML easier for a human to read and edit.
An easy way to check that cuboid regions are correct is to simply subtract the low coordinates from the high ones. The result should be the size of the region. If it is not, you may need to check both the coordinates and your calculation again.