save structure
Saves a structure to memory that was previously started using ||builder:start structure||
.
builder.saveStructure("my structure", false)
All of the Builder’s actions (blocks placed, etc.) are saved to memory as a struture. Call ||builder:load structure||
to paste it into the world.
This function will only work if called after ||builder:start structure||
.
Parameters
- name: a string that is the name of the structure.
- includeEntities: (optional) a boolean value that when
true
, all entities placed since the structure was started are saved. Iffalse
no entities are saved. - replaceAirWithVoid: (optional) a boolean value that when
true
, all blocks within the structure are set to nothing (void). Iffalse
, all air blocks remain as they are.
Example
This example constructs a 3x3x3 cube with random colors of concrete as a structure and then pastes that structure to create an even bigger cube.
player.onChat("cube", function () {
builder.teleportTo(pos(0, 0, 0))
builder.move(FORWARD, 5)
builder.setOrigin()
builder.startStructure()
for (let index = 0; index < 3; index++) {
for (let index = 0; index < 3; index++) {
for (let index = 0; index < 3; index++) {
builder.place([
LIGHT_BLUE_CONCRETE,
LIME_CONCRETE,
PINK_CONCRETE,
ORANGE_CONCRETE
]._pickRandom())
builder.move(FORWARD, 1)
}
builder.move(RIGHT, 1)
builder.move(BACK, 3)
}
builder.move(LEFT, 3)
builder.move(UP, 1)
}
builder.saveStructure("cube")
builder.teleportToOrigin()
builder.move(FORWARD, 10)
builder.move(LEFT, 4)
for (let index = 0; index < 3; index++) {
for (let index = 0; index < 3; index++) {
for (let index = 0; index < 3; index++) {
builder.loadStructure("cube")
builder.move(FORWARD, 4)
}
builder.move(RIGHT, 4)
builder.move(BACK, 12)
}
builder.move(LEFT, 12)
builder.move(UP, 4)
}
})
See Also
||builder:start structure||
||builder:load structure||
Here’s an example project that uses the builder: Build a house.