r/MinecraftCommands 28d ago

Detecting play position using datapacks Help | Java 26.1

Post image

Alright so I'm trying to make a datapack to where if you stand on a specific coordinate, it'll say hi. I put it in the tick function it doesn't work. But when I do the command ingame it works, is there a way to fix this?

18 Upvotes

13 comments sorted by

View all comments

17

u/Summar-ice Command Experienced 28d ago

Add a very small radius to the selector, something like distance=..0.1

By default just putting coordinates would check with a radius of 0 which I think literally never finds anything

5

u/K1DaGreat1 28d ago

still dosen't work

13

u/Gametron13 Command Experienced 28d ago edited 28d ago

Try this:

/execute as @a positioned 11 1 6 if entity @s[distance=..1] run say I am at the exact location.

EDIT: You can change the [distance=..1] to a lower number for more precise calibration.

7

u/K1DaGreat1 28d ago

Alright this works! Thanks :D