Minecraft / Blogs

Right Click detection 1.13+

  • 1 Diamonds
  • 148 views, 7 today
  • 0 comments
  • 0 favorites
  • 1
  • 0
  • comment
  • playlist_add
  • share
  • more_horiz
avatar PyroCreative
Level 21 : Expert Engineer
7
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

0 replies

Planet Minecraft

Browse

Site

© 2010 - 2019
planetminecraft.com

Welcome