how would I detect if player clicks with item such as stick or blaze rod?

I suppose this would use scoreboards?

I also can not use comparators or such, it will all be hooked up to a clock, although there can be commands which are only commenced once at the beginning.

the reason I cant use comparators is because I am creating a one command creation in a generator.

so far I have stared at a wall and tried to think of something.

  • Are you saying that you don't want to use comparators in your system that checks for the item? – Ben Jul 7 '15 at 0:51
  • Why can you not use comparators? What have you tried doing thus far? – Aequitas Jul 7 '15 at 0:55
  • Do you want to detect a right click or a left click? – Daniel G Jul 27 '16 at 1:53

You can do right click and left click detection, luckily, and 1.9 makes this easier than ever!


/scoreboard objectives add rClick stat.talkedToVillager
/scoreboard objectives add holdingBlazeRod dummy
/summon Villager ~ ~ ~ {CustomName:"ClickNpc",ActiveEffects:[{id:14b,Duration:10000,Amplifier:0}],Silent:1b,Offers:{}}

Put this in a clock:

/tp @e[type=Villager,name=ClickNpc] @p
/scoreboard players set @a holdingBlazeRod 0
/scoreboad players set @a holdingBlazeRod 1 {SelectedItem:{id:minecraft:blaze_rod}}

Type this in front of the command you want to execute when blaze rod is right clicked:

/execute @a[score_holdingBlazeRod_min=1,score_rClick_min=1] ~ ~ ~ ...


| improve this answer | |
  • Im surprised that this question hasnt gotten the "answer" certification from the question admin. – Chemical Comrade Dec 12 '16 at 7:52

The closest you could get would be the useItem statistic, but this only works for items that have a valid "use" action such as tools, weapons, placeable items/blocks, etc. Scoreboards is not currently possible for items without a "use" action (would be really nice for Mojang to add this in the future). A possible alternative (assuming the right click action is supposed to be a "1-time-use" action and not a continuous action would be to drop a named item on the ground and use the execute command (or similar) to check for a specific item type with a specific name.

| improve this answer | |
  • This, however, wouldn't work with sticks and blaze rods, as they can't be "used". And items that can be used (like blocks) would still be used (such as right-clicking with a dirt block; it will still place). The only "true" functionality with useItem is with fishing rods and carrots-on-a-stick. – Daniel G Jul 28 '16 at 13:16

You could get selected item by using a command like this with a command-block and a comparator :

/testfor @p {SelectedItem:{id:"minecraft:diamond_sword"}

And then you could use a right-click detector. See this video :

| improve this answer | |
  • 3
    Can you explain what they do on the video? As the video can be removed, we require answers to explain what they contain. – Ave Jan 1 '16 at 20:05
  • Link to video is dead – pppery Jun 25 '19 at 2:25

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.