Minecraft Blogs / Art

How to use the execute command (Beginer tutorial) For Java and Bedrock!

  • 3,725 views, 1 today
  • 4
  • 4
Wegph's Avatar Wegph
Level 41 : Master Modder
21
Parts in Italic and green are the command and orange parts are results
For most of these commands you will have to run it from a repeating command block

Java


To start the command you will write: /execute
now comes the difficult part as there is many options or subcommands I will only go over the useful ones.
Run : /execute run is the simplest one as it is basically the same as just typing out the command e.g. /say hello but is the most useful command as you use this in every other subcommand. e.g. /execute if @a[​name=wegph] run you need to write run after a subcommand so the games knows to run it.
As : /execute as is not that useful but fun as you can make other entity's run that command e.g. /execute as @e[​type=chicken] run say hello this would result in this : [​Chicken] Hello in the chat it may say this multiple times each time means 1 of that entity, if it says it 6 times it means there are 6 chickens (You can do this with any entity and even players if you write @p).
At: /execute at is probably the best and most fun command as you can do many things like place blocks where ever you walk or summon particle where ever you look or if you do some more advance things you can make things like iron golem spawn eggs or C4s with a detonator, it starts like this /execute at @e run setblock ~ ~-1 ~ minecraft:stone sets a stone block under every entity you can do this with any command, it will run the command at the place of the entity(s).
If: /execute if is probably as important as /execute at as most of the commands need "if" in it. To do "if" /execute if @e[​type=pig,distance=..10] run say Pig says "Pig" if there is a pig in a 2 block radius and like every other sub command you can do it with any other command!
You might need to mix some of these subcommands to get what result you want. I would try these out in game to understand them more.

Bedrock


/execute on the bedrock edition is so much easier it goes like this /execute ~ ~ ~ this is where you want to execute it /execute ~ ~ ~ @e/p/a/r/s what entity or player /execute ~ ~ ~ @e ~ ~ ~ where from that entity/player /execute ~ ~ ~ @e ~ ~ ~ "[​Any command]" where you put that command. This might seen confusing so ill tell you some examples /execute ~ ~ ~ @e[​type=snowball] ~ ~1 ~ summon tnt this will summon tnt 1 block above any snowball you throw (this is very destructive!) If this is still confusing then i would try in game but by changing certain elements.

Hopefully this has helped you to understand the execute command!
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome