load Structure

Load a saved structure into the world at a given position.

blocks.loadStructure("my structure", pos(0, 0, 0))

A previously saved structure will load into the world at the position that you give. You can specify if you want all or some of the elements of the structure included as the structure is re-created at that location.

The structure can also be loaded as transformation from its original state. It can appear rotated and mirrored across and axis if you choose those options. Also, you can choose to animate the loading of the structure where each element, blocks and entities, appear one after another as animation frames in the structure’s re-creation.

Parameters

  • name: a string that is the name of the structure.
  • to: the position to re-create the structure at.
  • rotation: (optional) the degrees to rotate the loaded structure from the original: , 90°, 180°, or 270°.
  • mirror: (optional) the mirroring axis to “flip” the loaded structure across: x axis, y axis, or xz axis.
  • animationMode: (optional) the type of animation to use during loading: none, block-by-block, or layer-by-layer.
  • animationSeconds: (optional) the number of seconds for the entire animation sequence.
  • includeEntities: (optional) a boolean value that when true, all entities from the original structure are included in the loaded structure. If false no entities are loaded.
  • includeBlocks: (optional) a boolean value that when true, all blocks from the original structure are included in the loaded structure. If false no blocks are loaded.
  • integrity: (optional) a number from 0 to 100 to specify how “exact” to place the blocks and entities relative to the original structure when rotated or mirrored.

Example

Make a chat command to build a fenced corral that surrounds the player. Fill the corral with some horses. Save the horse corral as a structure so you can load it somewhere in the world later. Make another chat command to load the corral at the player’s location but upside down.

player.onChat("makecorral", function () {
    blocks.fill(
    SPRUCE_FENCE,
    pos(-20, 0, -20),
    pos(20, 0, 20),
    FillOperation.Outline
    )
    for (let index = 0; index < 10; index++) {
        mobs.spawn(HORSE, randpos(
        pos(-19, 0, -19),
        pos(19, 0, 19)
        ))
    }
    blocks.saveStructure(
    "horse corral",
    pos(-20, 0, -20),
    pos(20, 0, 20)
    )
})
player.onChat("spawncorral", function () {
    blocks.loadStructure(
    "horse corral",
    pos(0, 0, 0),
    DEGREES0,
    Z
    )})

See also

||blocks:save structure||, ||blocks:delete structure||