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

Solved Reloading Chunks

Comments in 'Plugin Development' started by ImagicalGamer, Sep 29, 2016.

  1. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    I want to resend a chunk to all the players viewing it, I'm updating the grass color and tried using UpdateBlockPacket but that only updated blocks it didn't update the biome color. How can I achieve this? Any help is appreciated.

    FYI: I did use the search bar, looked at the docs, and looked at the source code.
    applqpak and dktapps like this.
  2. dktapps
    Offline

    dktapps Active Member

    Joined:
    Jul 25, 2016
    Posts:
    101
    You could use Level::requestChunk(), not sure if it would do what you want though:

    PHP:
    $player->getLevel()->requestChunk($player->getFloorX() >> 4$player->getFloorZ() >> 4$player);
    which will send the chunk next tick.
    Skullex, applqpak and ImagicalGamer like this.
  3. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    I'll try it thanks!
    XShockinFireX and dktapps like this.
  4. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    It didn't work :(, I did find a work around but it's not very practical. Is there a way to force unload a chunk like there is a level?
  5. dktapps
    Offline

    dktapps Active Member

    Joined:
    Jul 25, 2016
    Posts:
    101
    @ImagicalGamer In that case I suggest you clear the relevant chunks from the chunk cache, and then do what I said above.

    PHP:
    $player->getLevel()->clearChunkCache($player->getFloorX() >> 4$player->getFloorZ() >> 4);
    $player->getLevel()->requestChunk($player->getFloorX() >> 4$player->getFloorZ() >> 4$player);
    Note that that will only send the chunk the player is in. You'll need to increment/decrement the coords to send chunks around the player.
    Skullex and ImagicalGamer like this.
  6. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    That worked! Thanks!
    XShockinFireX and dktapps like this.

Share This Page

Advertisement