Solved Randomly Generate Custom Structures

Discussion in 'Spigot Plugin Development' started by Valenwe, Apr 3, 2020.

  1. Hello,

    I've been trying for a few days to know how to add custom structures in the generate process when Minecraft creates a world without another plugin (WorldEdit...). So far I explored a lot of websites and thread talking about this, but it was either outdated, either not working, either not well explicated.

    I searched for converting NBT or SCHEM files into String, but it seems it was pretty much impossible because of the compression (maybe I haven't search enough).

    Then I searched on how to use a NBT or SCHEM file to add in the default structure list of Minecraft, with no sucess...

    I found these posts:
    https://bukkit.gamepedia.com/Developing_a_World_Generator_Plugin
    https://tutorials.darkhax.net/tutorials/structure_gen/
    https://www.spigotmc.org/threads/1-13-x-nms-code-need-help-with-custom-generator.366584/

    But I couldn't use them to do what I want.

    After all those search, I decided to change to generate a structure not when the world is created, but when the chunk is loaded. But here again, I can't find how to generate the structure... Just that it will happen in a ChunkLoadEvent.

    Thanks for reading the post, and thanks for your help!
     
  2. Please, if you do have any information about that, even if it's to say that this is impossible, tell me
     
  3. There are APIs in worldedit to load schem file and convert it into material array.
    And instead of listening chunk load event, use ChunkPopulateEvent, as it will only trig once for every chunk.