mojira.dev
MC-128697

Distance tag in selectors isn´t working

Executing any data command such as:

/data get entity @e[distance=5,type=minecraft:shulker,limit=1]

Always gives the error:

No entity was found

Even if the entity is inside the specified radius.
Investigating the bug i found that the bug is caused by the distance tag.

Linked issues

Attachments

Comments 10

Your using the distance tag wrong. It should be /data get entity @e[distance=..5,type=minecraft:shulker,limit=1] for it to detect all entities in a range of 5 blocks away from you,
The reason why is that ..5 is equal to a whole five, and this parameter works in decimals (example: 1.1)

in the 1.12 when you use the distance tag with a integer number the game converts this integer to a decimal number

Commands are harder than in 1.12, from what snapshot the selector tags' value type must be EXACTLY the type used by the tag?

The command you originally used is not wrong syntax wise; but it will only target entities exactly 5 blocks away; distance is a range, like how rm and r together were, 1 = exactly 1, 1.. = 1 or more, ..1 = 1 or less, 1..2 = from 1 to 2 (inclusive); you don't need to provide decimals for it to work, but you can.

Even with the entity inside the specified radius the command still sending "No entity was found"

Yes, the shulker is 1 block away from the execution position and gives the error "No entity was found".
I tested the selector with a /say command and the shulker 1 block away from execution position and the command prints the player's name of players inside the radius(not tested on multiplayer)

Please provide a screenshot of the setup with the command visible in the chat/chat history.

Once again you used distance=10 (exactly 10 blocks) instead of distance=..10 (10 blocks or less)

nicolas rodriguez

(Unassigned)

Unconfirmed

command, selector

Minecraft 18w16a

Retrieved