Update your LWJGL. LWJGL is what actually handles the graphics and input, and interprets it in a way Java can understand. If your input doesn't work correctly, chances are it's LWJGL not working correctly.
If that doesn't work, rebind your sneak key to something else, and hold that instead of Shift.
You can do this using a villager with no trades and a stat.talkedToVillager
objective. This is because a villager without trades doesn't show the trade interface at all.
Summon an invisible ArmorStand with an invisible, silent Villager as it's passenger, like this:
/summon ArmorStand <x> <y> <z> {
Invisible:1b,
Marker:1b,
NoGravity:1b,
Passengers:[{
id:Villager,
Silent:1b,
NoAI:1b,
Invulnerable:1b,
Career:1,
CareerLevel:6,
Offers:{Recipes:[]},
ActiveEffects:[{
Id:14b,
Amplifier:0b,
ShowParticles:0b,
Duration:2147483647
}]
}]
}
Copy-paste version of the command:
/summon ArmorStand <x> <y> <z> {Invisible:1b,Marker:1b,NoGravity:1b,Passengers:[{id:Villager,Silent:1b,NoAI:1b,Invulnerable:1b,Career:1,CareerLevel:6,Offers:{Recipes:[]},ActiveEffects:[{Id:14b,Amplifier:0b,ShowParticles:0b,Duration:2147483647}]}]}
The armor stand serves purely as a way to hold the villager in place. Play around with <x> <y> <z>
until you find a good position for the villager. I suggest temporarily removing the villager's invisibility effect for "alignment" by replacing 2147483647
with 0
.
Now, create your objective
/scoreboard objectives add torchLever stat.talkedToVillager
Use a repeat/chain command block line to run the following commands:
/execute @a[x=X,y=Y,z=Z,r=R,score_torchLever_min=1] ~ ~ ~ <your command>
/scoreboard players set @a torchLever 0
Replace X
, Y
, Z
and R
with appropriate values. This is to prevent triggering your torch lever when interacting with any villagers.
Best Answer
In the video you linked from sethbling, he is actually just detecting the snowballs that are thrown, as snowballs are throw able. He's not detecting right clicks.
If you want to detect when an item is right clicked, the simplest method is to have an armor stand teleported exactly to you, and when you click the item, it the item will actually be put in to the armor stand's hand, which can then be detected. Once that's detected, you give the player another item, and set the armor stand's hand to empty. Rinse and repeat.
More info and commands can be found in this video: