1

I have looked at several questions that are close, but I still cannot get this. One question talks about checking a chest for any item, but I need to test for a specific item with a unique name.

I'm creating a quest. The player needs to bring back an Apple with the name "InnKeeper Apple".

I have tried this, but it is not working.

/testforblock 7652 62 744 minecraft:chest -1 {Item:{id:minecraft:apple,tag:{display:{Lore:["InnKeeper Apple"]}}}}

Any ideas?

1
  • I'm running a hosted server on spigot 1.9.4
    – ScottUSA
    May 31, 2016 at 18:38

1 Answer 1

2

Chests use an Items list to store their items. Lists surround their data with square brackets, and the data stored in this case are compounds (which surrounds data with curly brackets).

/testforblock 7652 62 744 minecraft:chest -1 {Items:[{id:minecraft:apple,tag:{display:{Lore:["InnKeeper Apple"]}}}]}
8
  • I just tried it and I get an error...... [14:15:43] The block at 7652,62,744 did not have the required NBT keys.
    – ScottUSA
    May 31, 2016 at 19:04
  • I tried added ,slot:0b ,Count:64b but still get the same error
    – ScottUSA
    May 31, 2016 at 19:11
  • Its a regular chest and not a trapped chest
    – ScottUSA
    May 31, 2016 at 19:12
  • @ScottUSA The command works in vanilla. Mods very rarely mix well with command mechanics. I can't say if there is any solution at all with Spigot.
    – Skylinerw
    May 31, 2016 at 19:18
  • Hmmm, .... I just tried it it 1.9.4/vanilla (single player) and not working. Getting the same error. I copied and pasted the command exactly, but changed the coordinates.
    – ScottUSA
    May 31, 2016 at 19:42

You must log in to answer this question.

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