Minecraft Blogs

Right Click detection 1.13+

  • 2
  • 1
  • 3
avatar PyroCreative
Level 26 : Expert Nerd
Hey guys !
I'm back...

With Another Minecraft Tutorial.
I haven't been posting since long... So I decided to write a very Simple Tutorial.

Today, We are going to detect when the player right clicks.

It's simple, and follows the Latest Java Edition Syntax.
REMEMBER THE FOLLOWING:- <comp> = comparator ; <rep></rep> = start repeat command block/end repeat command>
<imp></imp> = impulse command block.. <chat> = chat command line

Tarry ! The Best Part of the tutorial is that this method doesn't use -- a fishing rod, or a carrot_on_a_stick!!

strictly follow them in order)

1.<imp> summon villager ~ ~ ~ {NoAI:1,Silent:1,Invincible:1,Tags:["clickMe"],Offers:{}}</imp>
2.<chat> scoreboard objectives add RightClick minecraft.custom:minecraft.talked_to_villager (press tab after typing minecraft.custom:minecraft.t to find the statistic faster)
3.<chat> team add Click
4.<chat> team join Click @e[tag=clickMe]
5.<chat> team join Click @p
6.<chat> team modify Click CollisionRule never
7.<imp>effect give @e[tag=clickMe] invisibility 10000 10 true</imp>
8.<rep> teleport @e[tag=clickMe] @p</rep>

(p.s. basic syntax for /testfor alternative is execute if entity <selector>[<selectornbt>] )
1.<rep>execute if entity @p[scores={RightClick=1..}]</rep>
<imp> scoreboard players set @p RightClick 0</imp> (OPTIONAL SEGMENT IF YOU DO NOT WANT TO RESET SCOREBOARD DATA TO 0)
2.<rep>execute if entity @p[scores={RightClick=1..}]</rep>
<imp>(ANY COMMAND HERE)</imp>

And That's All.
All repeating command blocks should be set to 'Always Active'.
Activate the impulse command blocks with buttons as said to do so in order.

Hope this Helped.


03/21/2020 5:20 am
Level 26 : Expert Nerd
Thanks Nitdie.
I will come up with a solution to that problem too in a short while.
02/27/2020 4:16 am
Level 1 : New Miner
Very helpful,but when you left click,you will hit the villager and create some particles,i wonder how to solve that problem.
03/21/2020 5:28 am
Level 26 : Expert Nerd
Those are generic properties in-game.
You cannot hide the particles no matter what.
Make sure the Villager is aligned to you properly.
That should help :|
Planet Minecraft Logo


© 2010 - 2020