Structure - ShaneBeee/SkBee GitHub Wiki

SkBee's structure system utilizes Minecraft's built in structure block system. It allows for saving structures to file, and placing them back into the world. This new system requires Spigot/Paper 1.17.1+ (Spigot just recently added this new structure API)

Structure Object

The structure system revolves around the structure object. You can load one from file or create a new, empty one. From here you can fill it with blocks, modify some properties, save to file and place into the world.
We start off with the structure object expression:

structure[s] named %strings% 

If the structure is current saved to file, it will load that structure, if no file exists, it will create a blank one.
The name can be whatever you want, but you have 2 main options, you can either use the default Minecraft namespace, or your own.
If you do not specify a namespace, it will load from the SkBee namespace in your main world folder.

Example Code:

set {_s} to structure named "mystructure"

Where it loads from/saves to:

(main world folder)/generated/skbee/structures/mystructure.nbt

If you do specify a namespace, it will load/save from/to that folder.

Example Code:

set {_s} to structure named "mynamespace:mystructure"

Where it loads from/saves to:

(main world folder)/generated/mynamespace/structures/mystructure.nbt

Structure Filling

Once we have an empty structure object, we can fill it with blocks/entities.
The expression is pretty simple:

fill [structure] %structure% between %location% and %location%

This simply takes all the blocks in a cuboid region, and plops them into our structure. If there are any entities in there, they'll be saved in the structure as well.

Example Code:

set {_l1} to location(1,1,1, world "world")
set {_l2} to location(5,5,5, world "world")
fill structure {_s} between {_l1} and {_l2}

Simple right? I sure thought so.

Structure Properties

Each structure has a few properties that can be manipulated, including mirroring, rotation, inclusion of entities and integrity. These properties are only used for placing the structure in a world, they are NOT saved to the structure file.

Properties

Mirror determines which way the structure mirrors, either 'none', 'front back' or 'left right'.
Rotation determines which way the structure is rotated, either 'none', 'clockwise 90', 'clockwise 180' or 'counterclockwise 90'.
Integrity determines how damaged the building should look by randomly skipping blocks to place. This value can range from 0 to 1. With 0 removing all blocks and 1 spawning the structure in pristine condition.
Include entities determines if saved entities should be spawned into the structure (true by default).
Size returns a vector offset from the starting point of the structure. This cannot be changed.

Syntax

structure mirror of %structures%
structure rotation of %structures%
structure integrity of %structures%
structure include entities of %structures%
structure size of %structures%

Examples

set {_a} to structure mirror of {_s}
set structure mirror of {_s} to front back
set structure rotation of {_s} to clockwise 90
set structure integrity of {_s} to 0.75
set structure include entities of {_s} to false
set {_v} to structure size of {_s}

Structure Save

Once you have created and filled a structure, we can now save it.
Very simple syntax:

save [structure[s]] %structures% 

Example

save structure {_s}

Well... that was easy!

Structure Place

If you have loaded a structure, and maybe changed a few properties, we can now place it in the world.
Very simple syntax:

place [structure] %structure% at %location% 

Example:

place structure {_s} at target block of player

Well... that was also really easy!

Structure BlockStates

Once we have a structure defined, we can get a list of blockstates. These are captured states of the blocks in the structure.
Very simple syntax:

blockstates of [structure] %structure%

Example:

set {_blocks::*} to blockstates of structure {_s}

These blockstates hold a few pieces of info. Let's look at them all separately.

Offset

Offset is a vector, that means how far from the starting/corner block of a structure that this block is located.
For example, a vector of 2,2,2, means the x, y and z coords of the block are each 2 blocks away from the x, y and z coords of the starting block. Simple syntaxes:

block[ ]state offset[s] of %blockstates%

Example:

set {_offset} to blockstate offset of {_blocks::1}

BlockData

This represents the block data of a specific blockstate, ie: Minecraft:stone[] or minecraft:furnace[facing=east].
Simple syntax:

block[ ]data of [blockstate[s]] %blockstates%

Example:

set {_data} to block data of blockstate {_blocks::1}

Easy peasy right?

ItemType

This simply returns the item type of a blockstate in a structure.
Simple syntax:

[item[ ]]type of [blockstate[s]] %blockstates%

Example:

set {_type} to item type of blockstate {_blocks::1}