Q. What is the most effective /testfor command?

Ok, I've tried many variants of /testforcommand and tried them in the lastest snapshot, 15w31c, to 1.8.6 and nothing works AT ALL.

The list of commands I've tried:

  • /testfor @p {Inventory:[{id:"minecraft:iron_­sword"}]}
  • /testfor @p {Inventory:[{Slot:0b,id:"minecraft:­iron_sword"}]}
  • /testfor @p {SelectedItemSlot:0,Inventory:[{Slot:0b,id:"minecraft:iron_sword"}]­}
  • /testfor @p {Inventory:[{tag:{display:{Name:"Iron_Sword"}}}]}
  • And more but I can't remember them due to the frustration

The idea I'm trying to get at is you have a special book when right-clicked it'll spawn two items. One of them you must have on the second hand, in 15w31c, at all time that will interact with whatever weapon of your choosing, Swords, Axes, and Bow & Arrows. The second item is just a book so no real need for it to be forced on right now. I know I have to use /testfor for the book, second hand item, and weapons, but like I said nothing is working.


Tested the first 2 commands. Removing the quotes from minecraft:iron_sword and places a space after @p produces expected results.

enter image description here/testfor @p {Inventory:[{id:minecraft:ironsword}]}


enter image description here/testfor @p {Inventory:[{slot:0b,id:minecraft:iron_sword}]}


enter image description hereSame as above, but sword in wrong slot


In the first two examples, if you had those in a command block with a comparator attached, the comparator would output a 1 redstone strength. The last example would not output any redstone strength.