Skip to content

Instantly share code, notes, and snippets.

@ItsSpyce
Created June 7, 2015 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ItsSpyce/c409af480a327dedd243 to your computer and use it in GitHub Desktop.
Save ItsSpyce/c409af480a327dedd243 to your computer and use it in GitHub Desktop.
var position = new Position();
var val = connection.ReadLong();
position.X = (int) (val >> 38);
if (position.X >= (2 ^ 25)) position.X -= 2 ^ 26;
position.Y = (int) ((val >> 26) & 0xFFF);
if (position.Y >= (2 ^ 11)) position.Y -= 2 ^ 12;
position.Z = (int) (val << 38 >> 38);
if (position.Z >= (2 ^ 25)) position.Z -= 2 ^ 26;
return position;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment