For the first problem, you don't have to specify a slot or count when testing for NBT data. Try something like this:
/testforblock X Y Z chest -1 {Items:[{id:minecraft:gold_nugget}]}
That way, the command will succeed if any gold nuggets are in any slot.
No good way to do the second problem, AFAIK. Best way would be do:
- Break the chest with a
/setblock
Identify the golden nugget items that just dropped with a scoreboard objective, E.G: /scoreboard players set @e[type=Item] isNugget 1 {Item:{id:minecraft:gold_nugget}}
Change the NBT data of the dropped nuggets: /entitydata @e[type=Item,score_IsNugget_min=1] {Item:{tag:{display:{Name:"NUGGET"}}}}
Use a (minecart) hopper to scoop the items back up into a chest.
Key names and values must be separated with a colon; your id
tags are missing that colon.
You are also using an invalid quotation symbol ”
, when it needs to be "
instead.
Fixed command, removing excess keys (list elements do not use keys, despite the output shown).
/entitydata @e[type=chest_minecart,name=Command_Cart] {Items:[{Slot:0b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 0\"}"],author:"MeTheCommandCart",title:"Gamemode 0",resolved:1b},Damage:0s},{Slot:1b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 1\"}"],author:"MeTheCommandCart",title:"Gamemode 1",resolved:1b},Damage:0s},{Slot:2b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 2\"}"],author:"MeTheCommandCart",title:"Gamemode 2",resolved:1b},Damage:0s},{Slot:3b,id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"/gamemode @p 3\"}"],author:"MeTheCommandCart",title:"Gamemode 3",resolved:1b},Damage:0s},{Slot:4b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes under here"}},Damage:0s},{Slot:12b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes right of here"}},Damage:0s},{Slot:14b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes left of here"}},Damage:0s},{Slot:22b,id:"minecraft:paper",Count:1b,tag:{RepairCost:0,display:{Name:"Command goes above here"}},Damage:0s}]}
Best Answer
You can use the
/blockdata
command to see tile entity data. Providing no input will show the current state of that data. For instance, stand on top of a chest and run the following: