Detect if player clicks with item such as stick or blaze rod?
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.
You can do right click and left click detection, luckily, and 1.9 makes this easier than ever!
Prerequisites:
/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] ~ ~ ~ ...
Done!