Minecraft /execute Command
Executa um comando da perspectiva de outra entidade, localização, dimensão ou correspondendo a condições.
Compatibilidade de Versões
Sintaxe do Comando
/execute <subcommands...> run <command>/execute <subcommands...> run <command>Argumentos Explicados
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>TerminatorObrigatórioThe terminating command executed if all modifiers and condition checks succeed.
Exemplos Práticos
/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.
Erros Comuns
Erro:
Esquecer "run" antes do comando final no Java
Solução:
A sintaxe correta é: /execute as @p at @s run <command> (não esqueça "run")
Erro:
Usar "positioned" em vez de "at" para seguir um jogador
Solução:
"at @s" segue a posição da entidade, "positioned" define uma posição fixa.
Erro:
Confundir "as" e "at" - "as" muda o executor, "at" muda a posição
Solução:
"as @e" = mobs executam ; "at @e" = executa onde os mobs estão.
Diferenças entre Java e Bedrock
Ambas as edições agora suportam a sintaxe encadeada do /execute. Java usa `-> run` enquanto Bedrock usa `run` diretamente. A funcionalidade é essencialmente a mesma em atualizações modernas.
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.
Dicas Úteis
/execute é o comando mais poderoso do Minecraft - permite combinar condições e executar comandos de formas complexas.
Use "as @e" para mudar quem executa o comando, e "at @s" para mudar de onde é executado.
Combine "if block" e "unless block" para criar comandos condicionais baseados em blocos.
Use /execute para verificar condições antes de executar um comando, como verificar se um jogador está na água.
O subcomando "anchored eyes" executa o comando da posição dos olhos da entidade em vez dos pés.
Notas Importantes
Bedrock anteriormente usava uma sintaxe mais simples. No entanto, Bedrock agora suporta nativamente a sintaxe encadeada semelhante ao Java, tornando-as altamente unificadas em atualizações modernas.
Perguntas Frequentes
Posso executar um comando como se fosse outro jogador?
Sim: /execute as PlayerName at @s run <command> executa o comando como esse jogador na posição dele.
Posso executar um comando em outra dimensão?
Sim: /execute in the_nether run <command> executa o comando no Nether.
Posso executar um comando apenas se uma condição for atendida?
Sim: /execute if block ~ ~-1 ~ water run say Estou na água!
Comandos Relacionados
Pronto para criar seu comando?
Use nosso gerador interativo para criar comandos /execute sem erros com uma interface visual.
Abrir Gerador de Comandos