Load Structure
Loads a saved structure at the current location of the Builder.
builder.loadStructure("my structure", StructureRotation.Degrees0, StructureMirrorAxis.None)
Previously saved structures are loaded at the Builder’s current location. The structure can be loaded and optional transformed by rotation or mirroring across an axis.
This function works both for structures saved using ||builder:save structure||
and
for structures saved using the /structure
slash command.
Parameters
- name: a string that is the name of the structure.
- rotation: (optional) the degrees to rotate the loaded structure from the original:
0°
,90°
,180°
, or270°
. - mirror: (optional) the mirroring axis to “flip” the loaded structure across:
x axis
,y axis
, orxz axis
.
Example
This example builds a colorful spiral, saves it to a structure, and then rotates and mirrors it in all of the possible combinations to demonstrate how those parameters work. For each rotated/mirrored spiral, a gold block is placed at the location of the builder at the time the structure is loaded.
let color = 0
player.onChat("rotation", function () {
builder.teleportTo(pos(0, 0, 0))
builder.face(WEST)
builder.move(FORWARD, 5)
builder.setOrigin()
builder.startStructure()
for (let index = 0; index <= 5; index++) {
color = [
LIGHT_BLUE_CONCRETE,
LIME_CONCRETE,
PINK_CONCRETE,
ORANGE_CONCRETE,
BROWN_CONCRETE,
MAGENTA_CONCRETE
][index]
for (let index2 = 0; index2 < 3; index2++) {
builder.place(color)
builder.move(FORWARD, 1)
}
builder.move(BACK, 1)
builder.move(UP, 1)
builder.turn(LEFT_TURN)
}
builder.saveStructure("spiral")
builder.face(WEST)
builder.teleportToOrigin()
builder.move(FORWARD, 8)
for (let index = 0; index <= 3; index++) {
builder.setOrigin()
for (let index2 = 0; index2 <= 3; index2++) {
builder.move(FORWARD, 8)
builder.loadStructure("spiral", index2, index)
builder.place(GOLD_BLOCK)
}
builder.teleportToOrigin()
builder.move(RIGHT, 8)
}
})
See Also
||builder:start structure||
||builder:save structure||
Here’s an example project that uses the builder: Build a house.