Check if chunk is a spawnchunk.

Discussion in 'Plugin Development' started by Bammerbom, Sep 13, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Bammerbom

    I couldnt find any awnser on google, so I am asking it here.

    How to check if a chunk is a spawnchunk, using the Bukkit API?
     
  2. Offline

    RawCode

    what is spawnchunk?
     
  3. Offline

    Bammerbom

  4. Offline

    4thegame3

  5. Offline

    Bammerbom

  6. Offline

    4thegame3

    try to create yourself a method, i dont think bukkit has one
     
  7. Offline

    Bammerbom

    4thegame3
    The problem is that I have really no idea how I need to do this.
    That is why I created this forum post.
     
  8. Offline

    4thegame3

    hm, check the center of a chunk. a chunck is 16*16? add 16 to x and you find the center of second one..
    and keep going

    or check the corners of the 16*16 chunks aerea

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  9. Offline

    RawCode

    chunk is map section 16-16-256, size is fixed, your "article" is invalid, try again.
     
  10. Offline

    4thegame3

  11. Offline

    Bammerbom

    4thegame3
    NoSpawnChunks uses another mechanism, which is not possible to use here:
    Code:java
    1. @EventHandler(priority=EventPriority.LOWEST)
    2. public void onWorldInit(WorldInitEvent event) {
    3. World world = event.getWorld();
    4. world.setKeepSpawnInMemory(false);
    5. }
     
  12. Offline

    xize

    Bammerbom

    not sure though but what if you do:

    ??.getWorld().getSpawnLocation().getChunk() ?, I would definetly think thats the chunk.

    oh edit,

    I understand now what you are saying hmm there isn't really a method in bukkit what I can think off however what I know is that the serounding spawn chunks are based on the center chunk.

    but if you fly above the center chunk you probably see how the rows are loaded though I think they are around 3 * 16 or 6*16 as in rows
     
  13. Get the middle point of The spawn chunk and check if x and z distance from your chunk is small enough.
     
  14. Offline

    4thegame3

    sorry i decompiled it after my comment :p

    EDIT: but why u need to know if is a spawnchunk? maybe we can help you creating a method if you tell us.

    sorry for my english.
     
  15. Offline

    Bammerbom

    4thegame3
    A command to tell the player if they are standing in a spawnchunk or not.
     
  16. Offline

    4thegame3

    ahhhhh so its easy.
    check if player is at tot distance from the center
     
Thread Status:
Not open for further replies.

Share This Page