# ビルダーで構造物として保存する（builder.saveStructure）

> 「構造物の建築を開始する」を呼び出した後に建築したものを構造物として保存する。

- カテゴリ：ビルダー（builder）
- ブロック：ビルダー: "my structure"という名前の構造物として保存する エンティティを含む: false 空気をないものとして扱う: ○
- URL：https://makecode.minecraft-okinawa.com/reference/builder/save-structure/
- Pythonでの名前：builder.save_structure
- 公式データ取得日：2026-11-13
- 動作確認：確認待ち

## JavaScript

```javascript
builder.saveStructure("my structure", false)
```

## Python

```python
builder.save_structure("my structure", False)
```

## 引数

| 名前 | 値 | 意味 |
|---|---|---|
| name | 文字列 |  |
| includeEntities | 真偽値（true / false） |  |
| replaceAirWithVoid | 真偽値（true / false） |  |

## 使用例

### 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.

```javascript
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)
    }
})
```

```python
def on_on_chat():
    builder.teleport_to(pos(0, 0, 0))
    builder.move(FORWARD, 5)
    builder.set_origin()
    builder.start_structure()
    for index in range(3):
        for index2 in range(3):
            for index3 in range(3):
                builder.place([LIGHT_BLUE_CONCRETE,
                    LIME_CONCRETE,
                    PINK_CONCRETE,
                    ORANGE_CONCRETE]._pick_random())
                builder.move(FORWARD, 1)
            builder.move(RIGHT, 1)
            builder.move(BACK, 3)
        builder.move(LEFT, 3)
        builder.move(UP, 1)
    builder.save_structure("cube")
    builder.teleport_to_origin()
    builder.move(FORWARD, 10)
    builder.move(LEFT, 4)
    for index4 in range(3):
        for index5 in range(3):
            for index6 in range(3):
                builder.load_structure("cube")
                builder.move(FORWARD, 4)
            builder.move(RIGHT, 4)
            builder.move(BACK, 12)
        builder.move(LEFT, 12)
        builder.move(UP, 4)
player.on_chat("cube", on_on_chat)
```

## 出典

- [MakeCode for Minecraft 公式リファレンス（builder.saveStructure）](https://minecraft.makecode.com/reference/builder/save-structure)

執筆：鈴木孝昌（現役プロジェクトマネージャー／マイクラカップ指導者）／運営：沖縄マイクラ部 プログラミングスクール「クロスウェーブ」（https://minecraft-okinawa.com/）