daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function unpackMobMetadata(pkt) {
  2.     var x, data = {};
  3.     while((x = unpackers.byte(pkt)) != 0x7f) {
  4.         var id = x & 0x1f;
  5.         switch(x >> 5) {
  6.             case 0:
  7.                 data[id] = unpackers.byte(pkt);
  8.                 break;
  9.             case 1:
  10.                 data[id] = unpackers.short(pkt);
  11.                 break;
  12.             case 2:
  13.                 data[id] = unpackers.int(pkt);
  14.                 break;
  15.             case 3:
  16.                 data[id] = unpackers.float(pkt);
  17.                 break;
  18.             case 4:
  19.                 data[id] = unpackers.str16(pkt);
  20.                 break;
  21.             default:
  22.                 throw new Error('Can\'t figure out what ' + (x >> 5) + ' means');
  23.         }
  24.     }
  25.     return data;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top