tp
概要
tp は、エンティティをテレポートする ScriptEvent です。
座標、回転、ディメンションを指定してテレポートできます。
構文
/scriptevent capi:tp <パラメータ>
パラメータ
パラメータはJSON形式またはESON形式で指定できます:
- ESON
- JSON
{location=[x,y,z],rotation=[rx,ry],dimension=ディメンション名}
{
"location": [x, y, z],
"rotation": [rx, ry],
"dimension": "ディメンション名"
}
| パラメータ | 説明 | 必須 |
|---|---|---|
location | テレポート先の座標 [x, y, z] | ✓ |
rotation | 向き [rx, ry] | × |
dimension | ディメンション名 | × |
座標の指定方法
- 絶対座標:
100,64,-50 - 相対座標:
~10,~,~-5
使用例
絶対座標へのテレポート
指定した座標にテレポートします。
- ESON
- JSON
/execute as @a run scriptevent capi:tp {location=[100,64,100]}
/execute as @a run scriptevent capi:tp {"location": [100, 64, 100]}
相対座標へのテレポート
現在位置からの相対座標にテレポートします。
- ESON
- JSON
/execute as @a run scriptevent capi:tp {location=[~10,~,~10]}
/execute as @a run scriptevent capi:tp {"location": ["~10", "~", "~10"]}
向きを指定してテレポート
座標と向きを指定してテレポートします。
- ESON
- JSON
/execute as @a run scriptevent capi:tp {location=[0,64,0],rotation=[0,0]}
/execute as @a run scriptevent capi:tp {"location": [0, 64, 0], "rotation": [0, 0]}
ディメンションを指定してテレポート
異なるディメンションにテレポートします。
- ESON
- JSON
/execute as @a run scriptevent capi:tp {location=[0,64,0],dimension="nether"}
/execute as @a run scriptevent capi:tp {"location": [0, 64, 0], "dimension": "nether"}
利用可能なディメンション:
overworld- オーバーワールドnether- ネザーthe_end- ジ・エンド
スポーン地点へのテレポート
スポーン地点にテレポートします。
- ESON
- JSON
/execute as @a run scriptevent capi:tp {location=[0,64,0],rotation=[0,0]}
/execute as @a run scriptevent capi:tp {"location": [0, 64, 0], "rotation": [0, 0]}
ランダムな場所へテレポート
マクロを使用してランダムな座標にテレポートします(-100~100の範囲)。
- ESON
- JSON
/execute as @a run scriptevent capi:tp {location=[<!calc=floor(rand()*200)-100>,64,<!calc=floor(rand()*200)-100>]}
/execute as @a run scriptevent capi:tp {"location": ["<!calc=floor(rand()*200)-100>", "64", "<!calc=floor(rand()*200)-100>"]}
Calc マクロ
../Macro/Calc
他のプレイヤーの位置へテレポート
セレクターと組み合わせて、他のプレイヤーの位置へテレポートします。
- ESON
- JSON
/execute at @p[name=Notch] as @a[tag=teleport] run scriptevent capi:tp {location=["~","~","~"]}
/execute at @p[name=Notch] as @a[tag=teleport] run scriptevent capi:tp {"location": ["~", "~", "~"]}
注意事項
- エンティティに対して実行できます(ただし、エンティティはC-APIによるタグ情報やスコア情報を持っていません)
locationパラメータは必須です- 座標は配列として正確に3つの値を指定する必要があります
rotationを省略した場合、現在の向きが維持されますdimensionを省略した場合、現在のディメンションが使用されます
関連項目
- spawn_entity - エンティティをスポーン