TransWikia.com

What is the difference between the single dot, double dot and triple dot operators in Minecraft commands

Arqade Asked on April 4, 2021

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

@a[scores={myScore=7..}]

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

@a[scores={myScore=7...}]
@a[scores={myScore=7.}]

One Answer

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

Correct answer by Fabian Röling on April 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP