worldpoint: Add static fromRegion method

This commit is contained in:
Jordan Atwood
2019-02-17 19:26:56 -08:00
committed by Adam
parent 15fbbdd786
commit a18827f929
2 changed files with 12 additions and 6 deletions

View File

@@ -326,4 +326,15 @@ 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);
}
}