0

I have searched everywhere but I can't find the command in 1.12!

I want to make it so when someone picks up lapis lazuli, I get a redstone signal.

I have tried testfor @a {Inventory:{[Id:"minecraft:dye,Damage:4,Count:1"]}} But all it says is did not match required data structure!

5
testfor @a {Inventory:{[Id:"minecraft:dye,Damage:4,Count:1"]}}

Inventory is a list of compound tags - [{...},{...},{...},{...}]. Currently you've got it as a compound tag with a list inside without a key, when everything inside a compound tag requires a key.

Fix that to get:

testfor @a {Inventory:[{Id:"minecraft:dye,Damage:4,Count:1"}]}

Next, id needs a lowercase i, and its string should just be the item ID; Damage and Count are separate tags:

testfor @a {Inventory:[{id:"minecraft:dye",Damage:4,Count:1}]}

Finally, Damage and Count are a short and a byte respectively, rather than both integers. This will be auto-corrected when setting them, but for testing you'll need to specify their type.

The full fixed command should be:

testfor @a {Inventory:[{id:"minecraft:dye",Damage:4s,Count:1b}]}

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.