Partial Chunk Regeneration?

Discussion in 'Plugin Development' started by ryanhamshire, Feb 16, 2012.

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

    ryanhamshire

    Hi guys, I'm having an issue in that I want to regenerate PART of a chunk. I'd like to call on the default generator and populators to give me a chunk or chunksnapshot without applying it to the world, so that I can then apply it to the parts of the chunk I'm interested in.

    Is there ANY way I can make this happen? I did try taking a chunksnapshot first, then regenerating the chunk and reverting changes to the parts I wanted to keep, but that loses data like the contents of containers (chests), because those details are not included ina chunk snapshot (as far as I can tell).
     
  2. It is possible, though it may be difficult.
    World.getGenerator() returns the chunk generator associated with a world (I assume it also returns the vanilla one).
    The API doc for the Chunk generator's is here.
    http://jd.bukkit.org/apidocs/org/bukkit/generator/ChunkGenerator.html
    the .generate() method would be useful.

    You would have to parse the byte array returned into a chunk.

    Unknowns:
    - whether block populators are called by generate command. (http://jd.bukkit.org/apidocs/org/bukkit/generator/BlockPopulator.html)
    - how 1.2 will change this method.
    - whether this may affect the underlying chunk.
     
  3. Offline

    ryanhamshire

    Yeah, those were my underlying questions.

    If any of you can answer even one of these with certainty, I'd really appreciate the help!
     
  4. Block populators are called on a chunk, when the 4 side chunk are created
     
  5. Offline

    ryanhamshire

    Okay, but this isn't the usual case. Since I'm calling generator.generate() directly, should I also directly call upon the populators?

    I'm having anew issue. When I call world.getGenerator(), it returns null. WTF?
     
  6. at the default worlds, it return null
     
Thread Status:
Not open for further replies.

Share This Page