Chunk questions.

Discussion in 'Plugin Development' started by meguy26, Apr 8, 2015.

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

    meguy26

    I am working on terrain generation, and i need some help. In my block populator, there is the parameter "chunk" in the populate method, i have two questions about "chunk:"
    1. How would I get the adjacent chunk, in any direction?
    • I assume this could be dong by subtracting and adding to the chunkX and chunkZ, but for that I would need to know were/what these are, is the chunkX/Z actual block co-ords, or are they on a larger chunk by chunk scale?
    2. How can I check if a chunk is the spawn chunk?
    • I've honestly got no idea how to do this. I know i can figure out how to affect one chunk, and then others, but does the BlockPopulator always get called first for the spawn chunk?
    Thanks for any help provided!
     
  2. Offline

    mythbusterma

    @meguy26

    If you're generating terrain correctly, you don't need the chunks around your chunk. This would create infinite recursion if you relied on this.

    Second, the method you refer to has a reference to the world that requested the population, simply get that world's spawn and check if it's in your chunk.
     
  3. Offline

    meguy26

    @mythbusterma
    Well, what I want to do is generate a large, infinite, multi-chunk structure that starts in the spawn-chunk and continues into a random adjacent chunk. Is there a better method of doing this?

    Also, I found out the when you call .getX() or .getX() on a check it is NOT a block co-ord, it is on a larger chunk grid instead.
     
  4. Offline

    mythbusterma

    @meguy26

    Yes, you have to do that deterministic per chunk (this is actually usually done per x-z coord pair). There's a tutorial on making a terrain generator on here somewhere.

    That is correct, multiply by 16 to get the lowest x and z values for that chunk.
     
Thread Status:
Not open for further replies.

Share This Page