Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

sendChunk -> how it works?

Comments in 'Plugin Development' started by xpyctum, Mar 19, 2015.

  1. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    Hi. What it is $payload in sendChunk function?
    Maybe anyone know about this :)
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    The compressed/deflated buffer of the chunk to be sent in a FullChunkDataPacket.
  3. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    How i can compress buffer of the chunk?
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $payload is already encoded. You can decode it by zlib_decode()
  5. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    It's necessarily?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    What is necessary you mean? The $payload is something deflated, and you need to inflate it so that you can see the contents inside or modify them.
  7. xpyctum
    Offline

    xpyctum Active Member Plugin Developer

    Joined:
    Jan 13, 2014
    Posts:
    292
    Plugins:
    4
    Minecraft User:
    tylerdisney
    Hm. Created this, but didn't works

    PHP:
    $level $entity->getLevel();
    $payload zlib_decode($level);
    $player->sendChunk($x,$z,$payload);
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    zlib_decode() is to decode it. To pass to sendChunk, you should send the encoded payload.
    Also, zlib_encode() should be passed with your ordered binary data rather than the Level object.

Share This Page

Advertisement