This post is copied from https://www.spigotmc.org/threads/previewing-and-pasting-schematics-block-by-block.324817/
Today I will be showing you a cool way of letting a player build a schematic, for whatever you want to do. I've made this thread because I searched for this myself and it was hard to get to this point, so I thought somebody else might look for the same thing 🙂
Please note that this uses deprecated methods - Not in 1.13! -, so there might be a better way to do this. There may also be things I can do better. If so, please let me know! I have also used lombok so you may need to change some things.
What I will be showing you today is something like this:
Download the ZIP file here: https://gitlab.com/SamB440/Schematics-Extended/-/archive/master/Schematics-Extended-master.zip
A basic knowledge of Java and Spigot is also expected.
Move the contents of the ZIP file into your src. An example is included.
Everything has been documented, including what happens inside the methods. Please read through the code to understand what each part does.
Look at the example provided. It should be simple enough for you to understand to implement this in your own plugin. If you need help, just reply to this thread!
I hope I explained this well enough to you, and if you have any suggestions or questions blast away. This is my first resource so I probably got a lot of things wrong, but I thought this was pretty cool :p
Link to Source Code
Before pasting a schematic, you should load it using Schematic#loadSchematic. This will cache the data. Preferably, you only want to use this once to save resources.
I have made it so you can safely use it async. The only parts that are not async safe are the bits that HAVE to be run on the main thread, like the placement of blocks. I have made sure this is ensured.
This resource is only compatible with 1.13. 1.14 support will be added towards the end of this month.
You are free to use this in your plugin as you want, as long as you comply with the license, which can be found here: https://gitlab.com/SamB440/Schematics-Extended/blob/master/LICENSE.
I also ask you keep the credits in the source, and add me as a contributor to your resource page and an author in plugin.yml (as well as everyone else that has contributed).