Class 4 notes: Java Coding Class
Hi everyone! In the 4th java coding class today we learned the execute command. We only really went into the basics, but I will also include a part 2 for the execute command if you want to learn a little extra. For now, we will just be learning what we learned in class.
I also made a video explaining what we learned on my youtube channel if you want to watch that instead of reading this:
Class 4: Execute command! - YouTube
Now, onto the command: The execute command allows you to run any command off of any entity in the game. We use selectors for this. This allows you to pick what entities you want to affect. Selectors are a little bit complicated, so I made an article explaining in-depth everything about them, but if you don't want to read that I will explain the basics further down.
We have touched upon @a and @p before, but now I will introduce a new one: '@e'.
This means every single entity in the entire game, which counts as anything that has AI, or Artificial Intelligence. So, that counts as players, monsters, and animals, as well as more obscure ones like armor stands and arrows.
When we run the command:
This will kill every entity in the game. But what if, say, I only want to kill zombies? We can add a [ to it, and then a list of words will come up. It should look something like this: