1

I want to make a "lightning rod" in Minecraft. I'll have a stick or something that when right-clicked, it summons lightning one block in front of player.

How can I detect a player right-clicking with a specific item in hand?

marked as duplicate by MrLemon, angussidney, Frank, galacticninja, peacedog Feb 5 '16 at 15:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 6
    Related/possible duplicate – Nick B. Aug 8 '15 at 1:52
  • 1
    The answer depends on what the "something" you're right clicking with is. There are easy ways to detect placing down blocks, casting fishing rods, blocking with swords, etc.. Harder to detect if you're using a blaze rod or item that doesn't already do something special with right clicked, but still possible. – SirBenet Aug 8 '15 at 12:16
  • I want to use a stick, but now that you say it, a sword would be great! – Collin Fitch Aug 8 '15 at 13:02
  • @CollinFitch Also, does this need to work in 1.8.8 or are you using the snapshots? (Makes a difference, but not a huge one) – SirBenet Aug 8 '15 at 13:49
  • /testfor isn't for events, it detects entity presence. – vpzomtrrfrt Aug 13 '15 at 20:33
0

Well..you could use a fishing rod,and test for the entity when you right click the rod. The fishing rod bobber is an entity which gets summoned when you right click the fishing rod. The bobber's entity name is "unknown". So just /testfor @e[type=Unknown] Normal items can't be tested for right click because they don't do anything. The only way to do it,it's to do it with plugins

  • How exactly can s/he "use a fishing rod,and test for the entity when you right click the rod"? – Ave Nov 29 '15 at 10:53
  • Well,the fishing rod bobber is an entity which gets summoned when you right click the fishing rod. The bobber's entity name is "unknown". So just /testfor @e[type=Unknown] – Kez Nov 29 '15 at 10:57
  • 1
    adding that to the answer can be a better choice – Ave Nov 29 '15 at 11:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.