1

I want to use the /clear command to remove a book with the name “block” from a player’s inventory. I don’t want to take away just a normal book, how do I do this with commands in 1.16.2? I've tried:

clear @p minecraft:book 1 {display:{Name:”block”}} 

Which did not work, any help?

There is another similar question, but the answer to that is above, which does not work for me, maybe they changed how it works in an update?

3
  • @ExpertCoder14 Then fix my answer (or provide your own) on the linked question. Doesn't change the fact that this question is a dupe. – MBraedley Nov 29 '20 at 19:36
  • @MBraedley That's done. – ExpertCoder14 Nov 29 '20 at 19:39
  • We updated the answer on the linked question. It should answer the question well enough. Don't use the accepted answer, use the other answer marked 1.13 update. – ExpertCoder14 Nov 29 '20 at 19:40
0

You are using the old command syntax from 1.12. NBT data goes right after the item id and the amount goes after the NBT data. Example:

/clear @p book{NBT data here} <amount>

Also, strings work a bit differently in 1.16. You have to cancel out the quotes otherwise it's not a valid name. There are many ways to do that, and the one you pick depends on how you generated the item. For example, if you used an anvil to rename the book, you should use this name format: '{"text":"block"}' because that's what anvils use. If you used a /give command, then use whatever format you used in that command.

Correct version:

/clear @p minecraft:book{display:{Name:'{"text":"block"}'}} 1

Not the answer you're looking for? Browse other questions tagged or ask your own question.