Is chunk generated?

Discussion in 'Plugin Development' started by Cooliojazz, Mar 31, 2012.

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

    Cooliojazz

    Simple, is there any way to know whether a chunk has been generated or not yet? I ask because I have not been able to find any sort of function to do this in the logical places...
     
  2. Offline

    surtic

    yeh you can do this with

    world.isChunkLoaded(chunk);
     
  3. Offline

    Cooliojazz

    No, that just checks if the chunk is loaded, regardless of whether it's actually been generated or not yet.
     
  4. go inside the world files, and see if its there?
     
  5. I guess you could abuse the loadChunk method.

    Code:java
    1. World world = Bukkit.getServer().getWorld("MyWorld");
    2. int x = 0; //replace with position of chunk
    3. int z = 0; //replace with position of chunk
    4. if (!world.loadChunk(x, z, false)) {
    5. //chunk was not generated yet
    6. }


    See http://jd.bukkit.org/apidocs/org/bukkit/World.html#loadChunk(int, int, boolean)
    Code was not tested.

    [edit]
    Ignore the above and listen for ChunkLoadEvents. There is a method there called isNewChunk().
     
  6. Offline

    MoonStorm

Thread Status:
Not open for further replies.

Share This Page