ビルダーで構造物を読み込む builder.loadStructure
ひとことで言うと
指定された名前の構造物をビルダーの位置にロードする。
ブロックとコード
ビルダー:"my structure"という名前の構造物を読み込む 回転:○反転:StructureMirrorAxis.None
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
builder.loadStructure("my structure", StructureRotation.Degrees0, StructureMirrorAxis.None)builder.load_structure("my structure", DEGREES0, NONE)引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| name | 文字列 | |
| rotation | 数値 | |
| mirror | 数値 |
使用例
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.
JavaScript
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)
}
})Python
color = 0
def on_on_chat():
global color
builder.teleport_to(pos(0, 0, 0))
builder.face(WEST)
builder.move(FORWARD, 5)
builder.set_origin()
builder.start_structure()
for index in range(6):
color = [LIGHT_BLUE_CONCRETE,
LIME_CONCRETE,
PINK_CONCRETE,
ORANGE_CONCRETE,
BROWN_CONCRETE,
MAGENTA_CONCRETE][index]
for index2 in range(3):
builder.place(color)
builder.move(FORWARD, 1)
builder.move(BACK, 1)
builder.move(UP, 1)
builder.turn(LEFT_TURN)
builder.save_structure("spiral")
builder.face(WEST)
builder.teleport_to_origin()
builder.move(FORWARD, 8)
for index3 in range(4):
builder.set_origin()
for index22 in range(4):
builder.move(FORWARD, 8)
builder.load_structure("spiral", index22, index3)
builder.place(GOLD_BLOCK)
builder.teleport_to_origin()
builder.move(RIGHT, 8)
player.on_chat("rotation", on_on_chat)