I am currently trying to figure out how to get this command

execute if entity @p[distance=.11,nbt={SelectedItem:{tag:{display:{Name:"{\"text\":\"key\",\"color\":\"white\",\"bold\":\"true\"}"}}}}] run setblock -191 21 -52 minecraft:redstone_block

to work with an arrow renamed as "key" and then it in theory should open a Iron door that is nearby, just by being near it. However anytime I get close to the Iron door, nothing seems to change. I also have this command

execute unless entity @p[distance=.11,nbt={SelectedItem:{tag:{display:{Name:"{\"text\":\"key\",\"color\":\"white\",\"bold\":\"true\"}"}}}}] run setblock -191 21 -52 minecraft:stone_bricks

for when someone is near the area but without the item. That seems to work fine.

Can someone explain this to me? I am very confused in how to get it to work.

I'm using Minecraft 1.14.3.


You have a typo in your commands, instead of .11 you need to put ..11 for it to work. Also ensure you are running this in a Repeat Command Block set to Always Active.

Correct First Command:

execute if entity @p[distance=..11,nbt={SelectedItem:{tag:{display:{Name:"{\"text\":\"key\",\"color\":\"white\",\"bold\":\"true\"}"}}}}] run setblock -191 21 -52 minecraft:redstone_block

  • I got it to work. Thank you so much!
    – Invalid
    Jul 19 '19 at 15:29
  • @Invalid is this answer helped you, then please accept it.
    – pppery
    Jul 20 '19 at 20:37

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.