# 構造物として保存する（blocks.saveStructure）

> 指定した範囲の建物を、名前を付けて「構造物」として保存するブロックです。あとで別の場所に読み込めます。

- カテゴリ：ブロック（blocks）
- ブロック：構造物を保存する 名前"my structure" 範囲の始まり~0 ~0 ~0 範囲の終わり~0 ~0 ~0 エンティティを含む○ ブロックを含む○ 保存先○
- URL：https://makecode.minecraft-okinawa.com/reference/blocks/save-structure/
- Pythonでの名前：blocks.save_structure
- 公式データ取得日：2026-11-13
- 動作確認：確認待ち

## JavaScript

```javascript
blocks.saveStructure("my structure", pos(0, 0, 0), pos(0, 0, 0))
```

## Python

```python
blocks.save_structure("my structure", pos(0, 0, 0), pos(0, 0, 0))
```

## 引数

| 名前 | 値 | 意味 |
|---|---|---|
| name | 文字列 |  |
| from | 座標 |  |
| to | 座標 |  |
| includeEntities | 真偽値（true / false） |  |
| saveMode | StructureSaveMode |  |
| includeBlocks | 真偽値（true / false） |  |

## 使用例

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

```javascript
player.onChat("corral", 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)
    )
})
```

```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("corral", on_on_chat)
```

## 出典

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

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