Skip to content

Schematics

cheeezburga edited this page Sep 17, 2024 · 5 revisions

Saving a schematic

In skript-worldedit you can save any kind of region as a schematic. There is both an effect and a section to achieve this, so let's go through how each of them work.

Using the effect

When using the effect, the only thing you have to specify is the name of the schematic. This shouldn't include a path or any file extensions, as they will be set automatically.

You can also choose whether or not any existing schematic with the same name should be overwritten. The schematic won't be saved if another exists with the same name and you don't specify that it should overwrite.

Here's an example of the effect:

save {region} as a schematic named "example" and overwrite existing

Using the section

The section gives you much more potential when saving a schematic. In addition to being able to specify whether or not saving should overwrite existing schematics, you're also introduced to the following options:

  • copy entities: whether or not the saved schematic should also include entities within the region
  • copy biomes: whether or not biomes should be copied too
  • mask: a mask which will only let blocks that match be copied
  • origin: where the 'centre' of the schematic is
  • remove entities: whether or not entities that are copied should be removed

Just like in the effect, the name of the schematic is the only data that is mandatory; all this extra data is completely optional. You can mix and match whichever options you might need for a specific scenario.

With all this new information, let's have a look at an example of how the section might be used:

command /saveschem <string>:
    trigger:
        set {_region} to {regions::%arg-1%}
        save {_region} as a schematic named arg-1:
            copy entities: true
            copy biomes: false
            mask: mask from "stone,red_wool,blue_wool"
            origin: location of player
            remove entities: true
            overwrite: true

Pasting a schematic

Pasting a schematic is where the real fun begins.

This feature comes with an effect and a section too, the latter of which isn't too dissimilar to it's saving counterpart.

Using the effect

The effect requires, at a minimum, the name of the schematic that you're trying to paste, and the locations that you're trying to paste it at. The naming conventions are the same as before: no path and no file extension.

You can also specify a rotation (around the y-axis), and whether or not air should be ignored.

Here's an example of how the effect can be used:

paste schematic named "example" at {locations::*} rotated by 45 degrees and while ignoring air

Using the section

The section, once again, allows for further configuration before the schematic is pasted. In addition to the name, the rotation, and whether or not air should be ignored, the section also provides the following options:

  • paste entities: whether or not copied entities should be pasted
  • paste biomes: whether or not copied biomes should be pasted
  • mask: a mask that will only let matching blocks be pasted

These options are treated the same as the save section options - they're all optional, and can be used whenever necessary.

With all this in mind, let's have a look at an example of this section:

command /pasteschem <string>:
    trigger:
        paste schematic named arg-1 at location of player:
            rotation: 45
            paste entities: true
            paste biomes: true
            mask: mask from "stone,red_wool,blue_wool"
            ignore air: true

Deleting a schematic

Deleting a schematic is very easy, and very intuitive. There's only an effect for this, which is delete schematic %strings%.

You could probably guess how this works, but if the schematics exist, they get deleted! If not, skript-worldedit will tell you in the console that something unexpected happened (it probably couldn't find the file).

Where are schematics saved/loaded from?

skript-worldedit uses the same directory that WorldEdit and FAWE use to store their schematics. This allows you to access schematics that WorldEdit can (e.g. ones placed in the WorldEdit schematics folder), as well as allowing you to interact with schematics created by skript-worldedit via the WorldEdit commands.