保存した構造物を読み込む blocks.loadStructure
ひとことで言うと
保存しておいた構造物を、名前を指定して読み込むブロックです。回転や反転もできます。
ブロックとコード
構造物を読み込む 名前"my structure"読み込み先~0 ~0 ~0回転○反転○アニメーション種類○アニメーション時間(秒)○エンティティを含む○ブロックを含む○完全性○
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
blocks.loadStructure("my structure", pos(0, 0, 0))blocks.load_structure("my structure", pos(0, 0, 0))引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| name | 文字列 | |
| to | 座標 | |
| rotation | 数値 | |
| mirror | 数値 | |
| animationMode | StructureAnimationMode | |
| animationSeconds | 数値 | |
| includeEntities | 真偽値(true / false) | |
| includeBlocks | 真偽値(true / false) | |
| integrity | 数値 |
使用例
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. Make another chat command to load the corral at the player's location but upside down.
JavaScript
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("spawncorral", function () {
blocks.loadStructure(
"horse corral",
pos(0, 0, 0),
DEGREES0,
Z
)})Python
def on_on_chat():
blocks.fill(SPRUCE_FENCE,
pos(-20, 0, -20),
pos(20, 0, 20),
FillOperation.OUTLINE)
for index in range(10):
mobs.spawn(HORSE, randpos(pos(-19, 0, -19), pos(19, 0, 19)))
blocks.save_structure("horse corral", pos(-20, 0, -20), pos(20, 0, 20))
player.on_chat("makecorral", on_on_chat)
def on_on_chat2():
blocks.load_structure("horse corral", pos(0, 0, 0), DEGREES0, Z)
player.on_chat("spawncorral", on_on_chat2)