I'm trying to catch a thief in 1.19 Minecraft. I had one set of commands to see if items were taken out of a chest, but that was defeated -- I suspect they used X-ray hacked client to disable the command block:

/execute if block -109 63 208 chest{Items:[]} say @p is a thief

I want to duplicate the trap but also output to logs if they try to mine the command block again. I thought I could use this to see if they were too close:

/execute if entity @a[distance=..10] say @p is a vandal

but then realized if they have Xray, they can see the 2nd command block, suspect something was up, and avoid triggering the trap. I want to hide the 2nd block far away, so they only see the original command block

So I need a command to say

/execute if entity @a[distance_from_coords=..5| 102 59 210] say @p is a vandal

(an entity got within 5 blocks of the 1st command block)

Is there any way to do this, or otherwise clever way to catch the thief?

1 Answer 1


You can just use x=, y=, and z= to specify the location to calculate distance from:


This checks that the distance between the player and the specified coordinates is less than five blocks.

  • Aha! Thank you!
    – A. Niese
    Apr 28, 2022 at 1:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .