1

I'm trying to test for a written book in a chest but I keep getting the error message: Block at -1489,64,-1510 did not have the required NBT keys. I know there is a glitch were you have to fill in every NBT tag but please don't say it is the glitch because I filled in every tag. My command is below and I'm playing in 1.8.8, please help me!

/testforblock -1489 64 -1510 minecraft:chest -1 {Items:[{id:"minecraft:written_book",Slot:0b,Damage:0s,Count:1b}]}
5

Let's look at your data tag here carefully.

{
  Item:
  [
    id:"minecraft:written_book",
    Slot:0b,
    Damage:0s,
    Count:1b
  }
  ]
}

In this expanded form, you can immediately see that something is odd about your parentheses. There is a closing curly bracket without a partner. You'll have to add { before id (which is the first tag inside the item tag). Generally, when something is wrong, expanding the command over multiple lines and indenting properly at every layer is a good idea to catch these type of errors.

Secondly, the tag containing the item tags for chests is called Items, plural (cf. the wiki).

In total, the data tag needs to be

{
  Items:
  [
    {
      id:"minecraft:written_book",
      Slot:0b,
      Damage:0s,
      Count:1b
    }
  ]
}

Or compacted for easy copy and paste:

{Items:[{id:"minecraft:written_book",Slot:0b,Damage:0s,Count:1b}]}
  • It still doesn't work. What am I doing wrong. I have the book in the chest, I copy pasted your command, I'm confused. – KingDarren7203 Oct 28 '15 at 20:57
  • Never mind. Your command actually did work, but my book had an invalid tag. Thank you though! – KingDarren7203 Oct 28 '15 at 21:00
  • You can test for it in any slot if you leave out the slot tag – KingDarren7203 Oct 28 '15 at 21:03

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.