2

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.

1 Answer 1

2

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

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

You must log in to answer this question.

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