Saving block structures in a file

Discussion in 'Spigot Plugin Development' started by rightfootmessi, May 20, 2018.

  1. (I don't mean the structure blocks that were added in 1.10)

    Is there any easier way to save block structures other than a map of the blocks and their locations? Or is that the best route to take?

    Also, while I'm here, a bit of an (unrelated) noob question: exactly what difference does it make if I make onCommand() return true vs. false?
  2. If you want to save more than maybe 10 blocks then you usually use a schematic file, WorldEdit can be used to save and load these, take a look at the thread in my signature. Or you can do it by yourself if you have an exceptional case where using WorldEdit won't work by saving the block ids and data directly to a binary file (I did this one time when I needed block structures in a world generator which is called even before WorldEdit is loaded so that didn't work). You may need to further compress this file for example as a ZIP file.

    And the second question: If you return true, the Bukkit knows that command executed sucessfully and the player gave it the right arguments. By returning false, you signal that the player gave you some wrong arguments and Bukkit then shows the player the usage message which it gets from the plugin.yml file where you had to add the command.
  3. I mean it wouldn't really be large, the structures would occupy at most a 5x5x10 space, and most of that is gonna be air as well. Think I should still go the schematic route?
  4. Yes. Better than other approaches imo.
  5. You almost never save single blocks. Usually everything which involves saving where blocks are for pasting them in later on is done via schematics or a similar format. If you do not know what you are doing extremely well, just use always schematics with WorldEdit, there are almost no exceptions.
  6. Those blocks may have Nbt data, that concerns alot of stuffs.
    It's really a better way to use WorldEdit.