Command #4!:
The ADVANCED /execute command!! (no, it's not made for killing things)
Usage (Java ONLY): /execute run/at/as/if/align/anchored/facing/in/positioned/rotated/store/unless
(pick one)
Now, for simpler usage we will be using "at" and "run". here is an example:
/execute at @e[type=snowball] run summon arrow
The yellow which you can see is a target selector. Which tells Minecraft where or what it should do the thing. One will always start with @e/@a (more commonly @e). @e on its own is all entity's (all animals/players/armor stands/item frames), most commands will not allow this on its own. That's where the [ ] square brackets come in.
@e[type= is a type selector, meaning it picks a certain type of entity to activate on. So @e[type=snowball] will activate on all snowballs flying through the air.
Once Minecraft has a target, it will go on to the next part of the command.
/execute at @e[type=snowball] run summon arrow
After you have told it where to "run" (the target selector) it will go on to the run (which tells it that at all snowballs "run" a command). The command here is summon arrow. Can you guess what this command does?
(answer: it summons arrows wherever the snowball goes)
here is the full command for copy/paste:
/execute at @e[type=snowball] run summon arrow
copy/paste for pocket edition:
/execute @e[type=snowball] ~ ~ ~ summon arrow