1

I have a repeating command block set to "always active" running this command.

/effect give @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:stick", tag:{display:{Name:"Speed Stick Deodorant"}}}]}] minecraft:speed 1 7 true

In my offhand, I'm holding a stick given to me via this command:

/give @p stick{display:{Name:"\"Speed Stick Deodorant\""},Enchantments:[{id:unbreaking,lvl:10}]} 1

The output on the repeating command block says "No entity was found". What's wrong here?

I also tried giving myself the stick without enchantments to see if that was a problem. Didn't help.

  • Is the second \ in the Name bracket supposed to be in the second pair of quotation marks? – Reflexive Jun 4 at 22:01
  • Yes, it is. I don't think anything is wrong with the second line of code, but for some reason, the first line isn't working. – Kent Jun 4 at 22:14
1

You have different names for the stick. One is escaped and one is not. Without escaping the name it can't be interpreted properly, since it is inside another tag which already interprets the quotes.

Escape the name properly in your /effect command and it will work (tested and works for me):

/effect give @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:stick", tag:{display:{Name:"\"Speed Stick Deodorant\""}}}]}] minecraft:speed 1 7 true

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.