Selectors
In this tutorial, I will be showing you all about selectors and how you can use them in cool ways.
Selectors are the '@...'s that you may have seen a bit of already. In commands, when they are used they get replaced with a player or entity. For example if you use '@p' it is the nearest player so if you typed:
/say @p
It will come back with the nearest player (Which if typed in chat will be you)
There are 5 different ones of these.
Selectors are the '@...'s that you may have seen a bit of already. In commands, when they are used they get replaced with a player or entity. For example if you use '@p' it is the nearest player so if you typed:
/say @p
It will come back with the nearest player (Which if typed in chat will be you)
There are 5 different ones of these.
All of them being self explanatory (@s won't be very useful until you are more advanced)
But along with this selector you can also add parameters. Here is the full list of them:
But along with this selector you can also add parameters. Here is the full list of them:
Selection by Position
Argument(s)
x, y, z
distance dx, dy, dz |
Selection criteria
Coordinate
Radius Volume Dimensions |
Selection by Scoreboard Values
Argument(s)
scores
tag team |
Selection criteria
Scoreboard Score
Tags Team Name |
Selection by Traits
Argument(s)
limit
sort type name nbt gamemode advancements level y_rotation x_rotation |
Selection criteria
Limit
Sort Entities Entity Type Entity Name Entity Nbt Gamemode Achieved Advancements Experience Level Vertical Rotation Horizontal Rotation |
As you can see there are tones and I am not going to explain them all but I will go over how you use them and if you want to use any others the system works the same.
First of all we will use an '@e'
/say @e
First of all we will use an '@e'
/say @e
It comes back with everything in the world.
Now we will add some parameters to do this we put square brackets and add one of them in, I am going to use the 'limit'.
/say @e[limit=5]
Depending on what parameter you put in you will then put an equals and have your result so for this I want 5 entities.
Now we will add some parameters to do this we put square brackets and add one of them in, I am going to use the 'limit'.
/say @e[limit=5]
Depending on what parameter you put in you will then put an equals and have your result so for this I want 5 entities.
You can also put in multiple parameters separating them with commas:
/say @e[limit=5,sort=nearest,type=pig,distance=..50]
As you can see for the distance we have some full stops. For some parameters two full stops before means any value before as well so in our example is it any pigs within 50 blocks or LESS whereas if it was 'distance=50..' it would be 50 block or MORE. You can also use two values for example 'distance=20..30' and it would be mobs WITHIN 20 to 30 blocks.
Note for some you can also use an exclamation mark so it means 'NOT'. For example if I did:
/say @e[type=!pig]
It would say every entity that was NOT a pig.
I hope this helped! Remember if you have any questions just ask them here! ~Blue
/say @e[limit=5,sort=nearest,type=pig,distance=..50]
As you can see for the distance we have some full stops. For some parameters two full stops before means any value before as well so in our example is it any pigs within 50 blocks or LESS whereas if it was 'distance=50..' it would be 50 block or MORE. You can also use two values for example 'distance=20..30' and it would be mobs WITHIN 20 to 30 blocks.
Note for some you can also use an exclamation mark so it means 'NOT'. For example if I did:
/say @e[type=!pig]
It would say every entity that was NOT a pig.
I hope this helped! Remember if you have any questions just ask them here! ~Blue