delete Structure
Delete a previously saved structure.
blocks.deleteStructure("my structure")
A named structure is saved to either memory
or disk
. When you delete a structure, it is removed from its storage location and the structure name no longer refers to anything.
Parameters
- name: a string that is the name of a previously saved structure.
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. Also, make a chat command to remove the corral from memory.
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("removecorral", function () {
blocks.deleteStructure("horse corral")
})