1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Chunk Loader

Discussion in 'Help' started by ToddyWars, Feb 20, 2019.

  1. ToddyWars

    ToddyWars Spider Jockey

    Messages:
    30
    GitHub:
    ToddyWars
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Create a class that implements ChunkLoader, example MyChunkLoader

    Its best to store this somewhere and retrieve it later
    PHP:
    $this->chunkLoader = new MyChunkLoader();
    Then do this for any chunk you want to keep loaded
    PHP:
    $level->registerChunkLoader($this->chunkLoader,$chunkX,$chunkZ);
     
    ToddyWars likes this.
  3. ToddyWars

    ToddyWars Spider Jockey

    Messages:
    30
    GitHub:
    ToddyWars
    I want to put it in a room, in a house, so things inside it continue to work, this would not stay in the whole room, what should I do?
     
  4. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Get the chunks the room is in and follow my last post
    $chunk = $level->getChunk($pos->x >> 4,$pos->z >> 4);
     
    Last edited: Feb 21, 2019
    ToddyWars likes this.
  5. ToddyWars

    ToddyWars Spider Jockey

    Messages:
    30
    GitHub:
    ToddyWars
    I did, but how can I determine a block that when I put it up it is loading the 16x16 Chunk? Close to the block.
     
  6. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Sorry i dont understand your question
     
  7. ToddyWars

    ToddyWars Spider Jockey

    Messages:
    30
    GitHub:
    ToddyWars
    For everything to work, we have to be close, and instead of a player being close, but a certain block?
     
  8. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    You can save the positions of that block when it is placed then on LevelLoadEvent, register the chunkloader at those saved positions
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.