mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-30 03:05:37 -05:00
commit
97928a8b4b
1 changed files with 3 additions and 0 deletions
|
@ -1097,8 +1097,11 @@ function readBool(buffer, offset) {
|
||||||
function readPosition(buffer, offset) {
|
function readPosition(buffer, offset) {
|
||||||
var longVal = readLong(buffer, offset).value; // I wish I could do destructuring...
|
var longVal = readLong(buffer, offset).value; // I wish I could do destructuring...
|
||||||
var x = longVal[0] >> 6;
|
var x = longVal[0] >> 6;
|
||||||
|
if(x>33554432) x-=67108864;
|
||||||
var y = ((longVal[0] & 0x3F) << 6) | ((longVal[1] >> 26) & 0x3f);
|
var y = ((longVal[0] & 0x3F) << 6) | ((longVal[1] >> 26) & 0x3f);
|
||||||
|
if(y>2048) y-=4096;
|
||||||
var z = longVal[1] & 0x3FFFFFF;
|
var z = longVal[1] & 0x3FFFFFF;
|
||||||
|
if(z>33554432) z-=67108864;
|
||||||
return {
|
return {
|
||||||
value: { x: x, y: y, z: z },
|
value: { x: x, y: y, z: z },
|
||||||
size: 8
|
size: 8
|
||||||
|
|
Loading…
Reference in a new issue