Рет қаралды 128,879
Learn all about right click detection in vanilla Minecraft 1.17/1.18/1.19! I'll show you several methods (carrot on a stick, armor stand, villager, eye of ender, and more!*) Detecting right clicks is very useful for basically any project, ranging from custom guns/weapons, interactive menus, or... literally anything you want to be able to click. A must know! ;^)
Advancement Generator:
misode.github.io/advancement/
Chapters:
0:00 - Intro
0:44 - 10,000 IQ Method
1:02 - Carrot on a Stick vs. Warped Fungus on a Stick
2:38 - How to Code Carrot/Warped Fungus Detection
5:19 - Detecting Any Item (w/ Carrot on a Stick)
5:49 - subscribe :)
6:17 - Villager Method
7:24 - Armor Stand Method
8:50 - BEST Method?!?! (Eye of Ender Method)
CARROT/WARPED FUNGUS ON A STICK COMMANDS:
scoreboard objectives add carrot minecraft.used:minecraft.carrot_on_a_stick
OR
scoreboard objectives add carrot minecraft.used:minecraft.warped_fungus_on_a_stick
^ you should probably change this to "fungus" or something
execute as @a if score @s carrot matches 1.. at @s run function tutorial:carrot
(Make sure to change "tutorial:carrot" to your function name!)
scoreboard players reset @s carrot
PUT CARROT IN OFFHAND WHEN HOLDING ITEM (in this case, a diamond):
execute as @a[nbt={SelectedItem:{id:"minecraft:diamond"}}] run item replace entity @s weapon.offhand with carrot_on_a_stick
execute as @a[nbt=!{SelectedItem:{id:"minecraft:diamond"}}] run item replace entity @s weapon.offhand with air
ARMOR STAND METHOD:
execute as @e[type=armor_stand,nbt={HandItems:[{id:"minecraft:poppy"},{}]}] at @s run say detect!
(Replace "say detect!" with running a function that does whatever you want!)
My eye.json file (don't forget to change the function at the bottom):
{
"criteria": {
"eye": {
"trigger": "minecraft:using_item",
"conditions": {
"item": {
"items": [
"minecraft:ender_eye"
]
}
}
}
},
"rewards": {
"function": "tutorial:eye"
}
}
=== l o n k s ===
Discord Server [ / discord ]
Twitter [ / legitimoose ]
Twitch [ / legitimoose ]
My Editor [ / channel ]
that is actually how many i'll show you yes*
**but don't forget warped fungus on a stick