Regenerate Area

Discussion in 'Plugin Development' started by JungleSociety, May 8, 2014.

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

    JungleSociety

    Hello, I am here seeking help on regenerating an area of land. These topics are most likely very common, but I have not come across one that fully explains what I need. Anyways, I do not mean regenerating land to it's original state, like the regenerateChunk method does, I need it to regenerate it to a specific time in the past. This is for a minigame if that matters to much. I've tried saving when a player places or breaks a block to a hashmap as a BlockState, and then looping through the hashmap and updating the BlockState's, but I haven't got that to work. I'm not to sure that this method of regenerating would work or not anyways. So any comments on what I could do?
     
  2. Offline

    1Achmed1

    Plugins already do that ;)
     
  3. Offline

    JungleSociety

    1Achmed1
    Well, I would like to integrate it into my plugin, so if you could let me know if there is any good open source plugins that include regenerating areas, to take a look at the method they use, that would be great!
     
  4. Offline

    1Achmed1

    I would, but I don't remember what it's called. I want to say WorldProtect, but it isn't...
     
  5. Offline

    NathanWolf

    You can hook into WorldEdit to do this, I think. Just make a CuboidClipboard for the region, and then use the "paste" method to restore it.
     
  6. Offline

    rsod

    Worldedit itself has a function to regenerate selected area, I think TS can use it or copy code from it
     
  7. Offline

    NathanWolf

    I was suggesting he hook into WorldEdit's API if he wants to implement himself. His plugin would have to depend on WorldEdit, but this is a better approach than just wholesale stealing WorldEdit's code.

    Otherwise, yes, obviously he could just install WorldEdit and use //copy and //paste :)
     
  8. Offline

    JungleSociety

    Okay I'll look into the WorldEdit API. Would this have anything to do with loading and saving schematic files? Thanks,
     
  9. Offline

    tryy3

  10. Offline

    NathanWolf


    Not necessarily, but if you wanted to persist the area (like, save it once, then always be able to restore it) - a schematic is a great way to go. You wouldn't necessarily have to handle selecting and saving schematics in your code- just do that by hand with WorldEdit. It's reasonably easy to hook into WE to load a schematic into a clipboard and then paste that clipboard somewhere.

    If you do use schematics, you definitely want to go the API route. If you start copying their schematic code, you'll end up having to copy an entire NBT library :)

    I'm not aware of a stand-alone schematic loading/saving library, if there is one I'd love to know about it. If there isn't one, I'm hoping to make one eventually- I currently rely on WorldEdit for my plugins's schematic loading.
     
  11. Offline

    JungleSociety

    NathanWolf
    Thank you for your time and help, I'll most likely be trying the schematic route and see what world edit has to offer. It's not really a big deal that it depends on WorldEdit because almost every server uses it ;).
     
    NathanWolf likes this.
Thread Status:
Not open for further replies.

Share This Page