メインコンテンツまでスキップ

spawn_entity

概要

spawn_entity は、エンティティをスポーンする ScriptEvent です。
エンティティの種類、位置、名前、炎上状態を指定できます。

構文

/scriptevent capi:spawn_entity <パラメータ>

パラメータ

パラメータはJSON形式またはESON形式で指定できます:

{id=エンティティID,name=名前,location=[x,y,z],dimension=ディメンション名,fire=秒数}
パラメータ説明必須
idエンティティID
locationスポーン座標 [x, y, z]
nameエンティティの名前×
dimensionディメンション名×
fire炎上させる秒数×

使用例

シンプルなスポーン

クリーパーをスポーンします。

/scriptevent capi:spawn_entity {id=creeper}

名前付きエンティティ

名前を付けてゾンビをスポーンします。

/scriptevent capi:spawn_entity {id=zombie,name=ボスゾンビ}

座標を指定してスポーン

特定の座標にスケルトンをスポーンします。

/scriptevent capi:spawn_entity {id=skeleton,location=[100,64,100]}

相対座標でスポーン

プレイヤーの前方にエンダーマンをスポーンします。

/execute as @a run scriptevent capi:spawn_entity {id=enderman,location=["~","~","~5"]}

炎上状態でスポーン

炎上した状態でゾンビをスポーンします。

/scriptevent capi:spawn_entity {id=zombie,fire=10}

ネザーでスポーン

ネザーディメンションでブレイズをスポーンします。

/scriptevent capi:spawn_entity {id=blaze,location=[0,64,0],dimension=nether}

完全にカスタマイズされたスポーン

全てのオプションを設定してスポーンします。

/scriptevent capi:spawn_entity {id=wither_skeleton,name=§4炎の戦士,location= [100,64,100],dimension=overworld,fire= 999}

マクロを使用したスポーン

プレイヤー名を含む名前でスポーンします。

/execute as @a run scriptevent capi:spawn_entity {id=zombie,name=<!name>のゾンビ}

複数のエンティティをスポーン

繰り返しコマンドで複数のエンティティをスポーンします。

/execute as @a run scriptevent capi:spawn_entity {id=chicken,location=["~","~","~"]}

注意事項

  • idlocation は必須です
  • dimension を省略した場合、実行者のディメンションが使用されます
  • firetickではなく秒数で指定します
  • 無効なエンティティIDを指定するとエラーが発生します

関連項目

  • spawn_item - アイテムをスポーン
  • explosion - 爆発を生成
  • tp - エンティティをテレポート