I have a 2 tick repeater clock hooked up to a command block with this command in it...

testfor @p {SelectedItem:{id:minecraft:tripwire_hook,display:{Name:"Key to a House"}}}

When I hold the key, the comparator doesn't go on, and the door doesn't open.

| improve this question | | | | |
  • MBraedley, this is only 1 command block for easier door opening on my server. I do use fill / setblock clocks when making contraptions though, so don't worry. – Rogue Of Time Sep 12 '15 at 0:39
  • Even still, don't drop into bad habits. A setblock clock will also be less laggy than whatever clock you have set up, even if the difference is quite minor. – MBraedley Sep 12 '15 at 0:41

The SelectedItem uses the Item Structure, and under Item Structure there is no display tag. The display tag lies under the tag tag.

testfor @p {SelectedItem:{id:minecraft:tripwire_hook,tag:{display:{Name:"Key to a House"}}}}

Also note it is suggested to use @a selector instead of @p. Using @p will only activate if the player closest is holding the item.

| improve this answer | | | | |
  • 2
    You should mark @ModDL's answer as accepted by clicking the checkmark underneath the score if this solved your problem. – MBraedley Sep 12 '15 at 0:37

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.