0

How do you testfor a player holding a stick named Rainbow Stick and have the lore The best stick! in version 1.12?

1
  • The command should be something like /testfor @p {Inventory:[{Slot:-106b,id:"minecraft:stick", tag:{display:{Name:"Rainbow Stick", Lore:"The best stick!"}}}]} ...remember to encase names and values with spaces or : in them in " " (required as of 1.12)
    – dly
    Jun 18 '17 at 9:17
2

Didn't have access to Minecraft when I posted the comment, so just to finalize this question again as answer...

The part to access the offhand slot is Slot:-106b so the command is as follows:

/testfor @p {Inventory:[{Slot:-106b,id:"minecraft:stick", tag:{display:{Name:"Rainbow Stick", Lore:"The best stick!"}}}]}

As of 1.12 it is required to encase Strings with " " if they contain non-whitelisted characters (including : and spaces). This answer explains it.

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.