Minecraft /execute Command
別のエンティティ、場所、ディメンション、または条件に一致する perspectives からコマンドを実行します。
バージョン対応
コマンド構文
/execute <subcommands...> run <command>/execute <subcommands...> run <command>引数の解説
as <entity>SubcommandChanges who the executor (@s) is, without moving where the command runs.
at <entity>SubcommandChanges execution position (~ ~ ~), rotation, and dimension to match the entity.
positioned <pos>SubcommandExplicitly moves the execution location to coordinates (absolute or relative).
in <dimension>SubcommandExecutes within minecraft:overworld, the_nether, or the_end.
if / unless <condition>SubcommandEvaluates block matches, entity counts, score comparisons, or predicates before running.
store (result|success)SubcommandStores the numeric result or success count of the command into a scoreboard or NBT path.
run <command>Terminator必須The terminating command executed if all modifiers and condition checks succeed.
実用的な使用例
/execute as @a at @s if block ~ ~-1 ~ minecraft:water run effect give @s speed 5 1 trueGives speed boost to players who are currently standing on top of water.
Detecting ground blocks beneath players.
/execute as @e[type=cow] at @s run summon lightning_boltStrikes a lightning bolt at every cow in loaded chunks.
Changing both identity and position context.
/execute in minecraft:the_nether run tp @s 0 64 0Teleports the player to coordinates 0, 64, 0 in the Nether dimension.
Cross-dimensional teleportation.
/execute store result score @p CoinCount run clear @p gold_nugget 0Counts how many gold nuggets a player holds and stores the number in their CoinCount scoreboard.
Querying inventory amounts into variables without removing items.
/execute at @e[type=arrow] if block ~ ~-0.5 ~ minecraft:sand run setblock ~ ~-0.5 ~ minecraft:glassTurns sand into glass wherever an arrow lands.
Dynamic projectile impact mechanics.
よくあるミス
ミス:
Java版の最終コマンドの前に「run」を忘れる
修正方法:
正しい構文: /execute as @p at @s run <command>(「run」を忘れないで)
ミス:
プレイヤーを追跡するために「positioned」を「at」の代わりに使う
修正方法:
「at @s」はエンティティの位置を追跡し、「positioned」は固定位置を設定します。
ミス:
「as」と「at」を混同 - 「as」は実行者を変え、「at」は位置を変える
修正方法:
「as @e」= Mobが実行、「at @e」= Mobの位置で実行。
Java版と統合版の違い
両エディションが/executeのチェーン構文をサポートするようになりました。Javaは`-> run`を使用し、Bedrockは`run`を直接使用します。最新の更新では機能は基本的に同じです。
Command Block Usage & Automation
The cornerstone of command block logic. Run a Repeating Always Active command block with "/execute as @a at @s if block ~ ~-1 ~ slime_block run effect give @s jump_boost 2 3 true" to create custom trampoline jump pads, or use conditional chain blocks following execute checks to only advance storylines when a puzzle condition is met.
便利なヒント
/executeはMinecraftで最も強力なコマンド - 条件を組み合わせて複雑な方法でコマンドを実行できます。
"as @e"でコマンドの実行者を変更し、"at @s"で実行場所を変更します。
"if block"と"unless block"を組み合わせて、ブロックベースの条件付きコマンドを作成します。
プレイヤーが水の中にいるかなどの条件を確認する前に/executeを使用してください。
サブコマンド"anchored eyes"は足元ではなくエンティティの目の位置からコマンドを実行します。
重要な注意事項
Bedrock版以前はより簡単な構文を使用していました: `/execute <origin> <position> <command>`。しかし、Bedrock版は現在Javaに似たチェーン構文をネイティブにサポートしており、最新の更新でほぼ統一されています。
よくある質問
他のプレイヤーとしてコマンドを実行できますか?
はい: /execute as PlayerName at @s run <command>でそのプレイヤーの位置でコマンドを実行します。
別のディメンションでコマンドを実行できますか?
はい: /execute in the_nether run <command>でネザーでコマンドを実行します。
条件が満たされた場合のみコマンドを実行できますか?
はい: /execute if block ~ ~-1 ~ water run say 水の中にいる!