Minecraft Blogs / Tutorial

Right Click detection 1.13+

  • 6,348 views, 1 today
  • 3
  • 1
  • 3
PyroCreative's Avatar PyroCreative
Level 34 : Artisan Nerd
9
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!!

COMMANDS:-
(
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>

TESTING SEGMENT:-
(p.s. basic syntax for /testfor alternative is execute if entity <selector>[<selectornbt>] )
1.<rep>execute if entity @p[scores={RightClick=1..}]</rep>
<comp>
<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>
<comp>
<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.


Tags

Create an account or sign in to comment.

1
03/21/2020 5:20 am
Level 34 : Artisan Nerd
PyroCreative
PyroCreative's Avatar
Thanks Nitdie.
I will come up with a solution to that problem too in a short while.
1
02/27/2020 4:16 am
Level 1 : New Miner
Nitdie
Nitdie's Avatar
Very helpful,but when you left click,you will hit the villager and create some particles,i wonder how to solve that problem.
1
03/21/2020 5:28 am
Level 34 : Artisan Nerd
PyroCreative
PyroCreative's Avatar
Sorry,
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

Website

© 2010 - 2024
www.planetminecraft.com

Welcome