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: minecraft.wiki/w/Display#Enti...
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: www.planetminecraft.com/data-...
- 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.
- Non-datapack solution: /execute as @e[type=interaction] at @s if data entity @s interaction run your_command
- and at the end of your command line: /execute as @e[type=interaction] at @s if data entity @s interaction run data remove entity @s interaction
- You can also use @e[type=interaction,nbt={interaction:{}}] instead of the if data part of the command, and don't forget you can use tag=your_tag to narrow down the search further.
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: • Talon's Oasis - Season 3
Original (Old) Talon's Oasis: • Talon's Oasis - Season 1
Ending Music:
"Pamgaea" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0
creativecommons.org/licenses/b...
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
Негізгі бет Ойындар How To Make Clickable Displays (Right Click Detection) in Minecraft
Пікірлер: 11