Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* A dynamic World Deserializer
- Created by Krock
- License: BSD 3-Clause
- First, define the variables "c" and "m".
- Variable "m" is a PlayerIOClient.Message
- For the "init" message:
- uint c = 20; // EE
- uint c = 13; // EE CM
- For the "reset"/loadlevel message:
- uint c = 0;
- */
- while (c < m.Count) {
- if (m[c].ToString() == "we")
- break;
- int b = m.GetInt(c),
- l = m.GetInt(c + 1);
- byte[] pX = m.GetByteArray(c + 2),
- pY = m.GetByteArray(c + 3);
- var arg3 = null;
- // Get additional information about the current block
- // if (b == 43) {
- // arg3 = m.GetInt(c + 4)
- // }
- for (int n = 0; n < pX.Length; n += 2) {
- int x = pX[n] << 8 | pX[n + 1];
- int y = pY[n] << 8 | pY[n + 1];
- // Add the blocks to your block array here
- // Variables l, b, x and y are defined
- }
- ushort argC = 4;
- for (uint i = c + 4; i < m.Count; i++) {
- if (m[i] is byte[]) {
- argC -= 2;
- break;
- } else if (m[i].ToString() != "we") {
- argC++;
- } else break;
- }
- c += argC;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement