Merge pull request #5890 from Nightfirecat/colored-ground-markers

Add support for colored ground markers
This commit is contained in:
Tomas Slusny
2019-03-02 11:36:40 +00:00
committed by GitHub
7 changed files with 208 additions and 56 deletions

View File

@@ -326,4 +326,36 @@ public class WorldPoint
{
return ((x >> 6) << 8) | (y >> 6);
}
/**
* Converts the passed region ID and coordinates to a world coordinate
*/
public static WorldPoint fromRegion(int regionId, int regionX, int regionY, int plane)
{
return new WorldPoint(
((regionId >>> 8) << 6) + regionX,
((regionId & 0xff) << 6) + regionY,
plane);
}
/**
* Gets the X-axis coordinate of the region coordinate
*/
public int getRegionX()
{
return getRegionOffset(x);
}
/**
* Gets the Y-axis coordinate of the region coordinate
*/
public int getRegionY()
{
return getRegionOffset(y);
}
private static int getRegionOffset(final int position)
{
return position & 0x3f;
}
}