How To Make Clickable Displays (Right Click Detection) in Minecraft
It's like a button that can look like anything you want (item, block, text) and can trigger anything you want. Definitely a valuable tool for any mapmaker, and I'll be showing you how to easily create this wonderful clickable display.
00:06 Step 1: The Display
- Item: /execute summon minecraft:item_display run data merge entity @s {brightness:{sky:15,block:15},transformation:{scale:[0.2,0.2,0.2]},item:{id:"purple_concrete",Count:1},billboard:"center",Tags:[your_tag]}
- or Block (delete align xyz if you don't want it to snap to grid: /execute align xyz summon minecraft:block_display run data merge entity @s {brightness:{sky:15,block:15},transformation:{scale:[1.0,1.0,1.0]},block_state:{Name:"purple_concrete"},billboard:"fixed",Tags:[your_tag]}
- or Text: /execute summon minecraft:text_display run data merge entity @s {brightness:{sky:15,block:15},transformation:{scale:[1.0,1.0,1.0]},text:'"purple_concrete"',billboard:"center",Tags:[your_tag]}
- Advanced Display Options: https://minecraft.wiki/w/Display#Entity_data
03:14 Step 2: Right Click Detection
- Change item_display to be block_display or text_display respectively.
- Interaction Entity: /execute as @e[type=minecraft:item_display,sort=nearest,limit=1] at @s positioned ~ ~ ~ summon interaction run data merge entity @s {width:0.2,height:0.2,response:1,Tags:[your_tag]}
- Note: Each display entity has a DIFFERENT origin point and therefore you will have to adjust the positioned parameter a little differently for each one (block displays need half added in the x and y and text displays need nothing). If you need to delete and try again use this command: /kill @e[type=interaction,sort=nearest,limit=1]
05:29 Step 3: Advancement Trigger
- Template Datapack: https://www.planetminecraft.com/data-pack/basic-template-6096089/
- Compact Advancement: {"criteria": {"example": {"trigger": "minecraft:player_interacted_with_entity","conditions": {"entity": {"type": "minecraft:interaction","nbt": "{Tags:[\"your_tag\"]}"}}}},"rewards": {"function": "template:example"}}
- Note: If you change the file names or the namespace, don't forget to update template:example with the new namespace:file_name.
6:22 Step 4: The Output Code
- "Reset Button": advancement revoke @s only template:example
- Advanced Technique: You can use @e[type=interaction,nbt={interaction:{}},sort=nearest,limit=1] to track closest interacted entity from the player's position (who triggered the advancement). And then at the end of the file you can clean it up with /data remove entity @e[type=interaction,nbt={interaction:{}},sort=nearest,limit=1] interaction. This is useful if you have a lot of clickable displays next to each other and you need to only trigger one. And don't forget you can use tag=your_tag to track specific interaction entities if you need to narrow it down further.
My Main Let's Play:
Talon's Oasis Season 3: https://www.youtube.com/playlist?list=PLlBKpA-F_inGo3_j1lEuEIOWYGd5wZkJf
Original (Old) Talon's Oasis: https://www.youtube.com/playlist?list=PLlBKpA-F_inEvT1CF9srKkl9R4Ecs7ueL
Ending Music:
"Pamgaea" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0
http://creativecommons.org/licenses/by/3.0/
Not an official Minecraft product. Not approved by or associated with Mojang.
Chapters:
00:00 Step 1: The Display
03:14 Step 2: Right Click Detection
05:29 Step 3: Advancement Trigger
06:22 Step 4: The Output Code
07:17 Finished Product
#CommandBlockTutorial #MinecraftHowTo #Talon2863
Other Videos By Talon
Other Statistics
Minecraft Statistics For Talon
Talon presently has 461,370 views for Minecraft across 180 videos, with the game making up over 3 days of published video on his channel. This is 61.38% of the total watchable video for Minecraft on Talon's YouTube channel.