Minecraft /execute Command
Exécute une commande depuis la perspective d'une autre entité, emplacement, dimension ou en correspondant à des conditions.
Compatibilité des Versions
Syntaxe de la Commande
/execute <subcommands...> run <command>/execute <subcommands...> run <command>Arguments Expliqués
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>TerminatorRequisThe terminating command executed if all modifiers and condition checks succeed.
Exemples Pratiques
/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.
Erreurs Courantes
Erreur :
Oublier "run" avant la commande finale en Java
Correction :
La syntaxe correcte est : /execute as @p at @s run <command> (n'oubliez pas "run")
Erreur :
Utiliser "positioned" au lieu de "at" pour suivre un joueur
Correction :
"at @s" suit la position de l'entité, "positioned" définit une position fixe.
Erreur :
Confondre "as" et "at" - "as" change l'exécuteur, "at" change la position
Correction :
"as @e" = les mobs exécutent ; "at @e" = s'exécute là où sont les mobs.
Différences Java vs Bedrock
Les deux éditions supportent maintenant la syntaxe chaînée de /execute. Java utilise `-> run` tandis que Bedrock utilise `run` directement. La fonctionnalité est essentiellement la même dans les mises à jour modernes.
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.
Conseils Utiles
/execute est la commande la plus puissante de Minecraft - elle permet de combiner des conditions et d'exécuter des commandes de manière complexe.
Utilisez "as @e" pour changer qui exécute la commande, et "at @s" pour changer d'où elle est exécutée.
Combinez "if block" et "unless block" pour créer des commandes conditionnelles basées sur des blocs.
Utilisez /execute pour vérifier des conditions avant d'exécuter une commande, comme vérifier si un joueur est dans l'eau.
Le sous-commane "anchored eyes" exécute la commande depuis la position des yeux de l'entité au lieu des pieds.
Notes Importantes
Bedrock utilisait précédemment une syntaxe plus simple. Cependant, Bedrock supporte maintenant nativement la syntaxe chaînée similaire à Java, les rendant très unifiées dans les mises à jour modernes.
Questions Fréquentes
Puis-je exécuter une commande comme si j'étais un autre joueur ?
Oui : /execute as PlayerName at @s run <command> exécute la commande comme ce joueur à sa position.
Puis-je exécuter une commande dans une autre dimension ?
Oui : /execute in the_nether run <command> exécute la commande dans le Nether.
Puis-je exécuter une commande seulement si une condition est remplie ?
Oui : /execute if block ~ ~-1 ~ water run say Je suis dans l'eau !
Commandes Liées
Prêt à créer votre commande ?
Utilisez notre générateur interactif pour créer des commandes /execute sans erreur grâce à une interface visuelle.
Ouvrir le Générateur de Commandes