I've been using the double dot (..) operator in commands ever since they were introduced but I've recently noticed that I can use just a single dot, double dot and a triple dot as well. What is the difference between the three?

for example, this selector will target players with a score of 7 or more


but what if I were to use three dots or a single dot?


You're using floating-point numbers. Single dots are simply the decimal separator.
Example, everyone from 1.5 to 2.3 blocks away from you: @a[distance=1.5..2.3]

You can also leave out either the digits before the separator or behind it, in which case it will assume 0.
Example, everyone from 0.1 to 0.3 blocks away from you: @a[distance=.1...3]
And everyone with an X rotation from -10 to +0.5: @a[x_rotation=-10....5] (The -10. could just as well just be -10 here.)

If you have just one dot, you're not using a range at all anymore.
Example, this will only match someone who is exactly 0.5 blocks away from you, which is pretty much impossible to achieve with regular walking: @a[distance=0.5]
The same here: @a[distance=.5]

You can even leave out one of the numbers completely, in that case you create a partially unbounded range.
Example, this will match everyone who is at least 10 blocks away from you: @a[distance=10..]

In NBT you can sometimes even leave out both the digits before and after the comma:
Example, this will stop a zombie from moving by setting its motion to 0: /data merge entity @e[type=zombie,limit=1] {Motion:[.,.,.]}
This does not work in selectors, for example this does not check from 0.0 to 2, but from 0 (unbounded) to 0.2: @a[distance=...2]
And this does not work at all: @a[distance=...2]

Fully unbounded arrays (@a[distance=..]) do not work (otherwise that example would match everyone alive (not on the game over screen) in the same dimension as you).

See also: https://gaming.stackexchange.com/a/345496/171580

| improve this answer | |
  • haha, I see what you mean, if I don't include the second digit of a decimal number and use the double dot operator, it will result in three dots right next to each other but it's really two dots and a decimal point. Thanks for the info, I haven't looked at it that way. – MegaCrafter10 Nov 28 '19 at 12:31
  • I edited it now after testing the edge cases. – Fabian Röling Nov 28 '19 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.