Okay, so I'm making a sell shop in Minecraft using commands, but I need to know, how do I get different types of logs using the command?

/testfor @p {Inventory:[{id:"minecraft:log",Count:32b}]}

I've tried doing log:2 and all that, and I can't find anything online. Could someone please help?

  • What do you mean by "get different types of logs using the command"? Do you want to detect any type of log, or a specific type of log (if so, which?). – SirBenet Jan 30 '16 at 10:51
  • @colorfusion I want to use a different type of log, like birch or spruce. – rainbowlack Jan 30 '16 at 18:59
  • If you want the command to allow a specific type of log only, and not other types, then Skylinerw's answer should work for you. – SirBenet Jan 30 '16 at 19:32

The Damage short tag stores the Damage value of the item:

/testfor @p {Inventory:[{id:"minecraft:log",Damage:2s,Count:32b}]}
  • 2
    Also worth noting that Acacia and Dark Oak have the id of minecraft:log2. – SirBenet Jan 30 '16 at 19:33


/tesfor @p[Inventory:[{id:"minecraft:log",Damage:3,Count:32}]]
  • 1
    That's not how target selectors work. You cannot insert NBT data directly into a selector. Even futher, when testing for pre-existing data, you must include datatypes for all tags. – Skylinerw Jan 31 '16 at 18:27

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.