save Structure

Save a structure that exists within the space of two positions that you give.

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

A structure can include blocks, mobs, and other entities within a particular space. You can select a space, using positions, to contain the elements of your structure and save it for use later somewhere in the world. The structure is given a name so you can refer to it uniquely when you want to load it in the world.

Parameters

  • name: a string that is the name of the structure.
  • from: the starting position to save a structure from.
  • to: the ending position to save a structure to.
  • includeEntities: (optional) a boolean value that when true, all entities within the from and to positions are included in the structure. If false no entities are saved.
  • includeBlocks: (optional) a boolean value that when true, all blocks within the from and to positions are included in the structure. If false no blocks are saved.
  • saveMode: (optional) the place that the struct is saved to: memory or disk.

Example

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.

player.onChat("corral", 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)
    )
})

See also

||blocks:load structure||, ||blocks:delete structure||