Minecraft execute tellraw's clickEvent from original entity, not player
I'm using a command like this:
/execute @e[type=ArmorStand] ~ ~ ~ tellraw @a[score_goto=-1]
{
"selector": "@e[type=ArmorStand,r=1]",
"clickEvent": {
"action": "run_command",
"value": "/tp @p ~ ~ ~"
},
"color":"blue"
}
To try and make each armor stand in the world say their name (in blue), and, if the player clicks the armor stand's name in-chat they will be teleported to that armor stand.
Currently, it looks like this:
And, when I click either of the two names, I'd like to be teleported to that armor stand, hence the
"clickEvent":{"action":"run_command","value":"/tp @p ~ ~ ~"}
part within the command.
However, because run_command
apparently only inserts the command into the player's chat, I just get teleported to wherever I currently am when I click any name.
So, I tried:
"clickEvent": {
"action": "run_command",
"value": [
"/tp @p @e[type=ArmorStand,name=",
{"selector": "@e[type=ArmorStand,r=1"},
"]"
]
}
Thinking that maybe the JSON in value would be parsed, producing my desired value of
"value": "/tp @p @e[type=ArmorStand,name=Name_Of_This_Armor_Stand]"
but no luck.
Everything I've tried just doesn't seem to work, can someone please help me find a way to make a tellraw clickEvent teleport the player to the entity which executed the tellraw command?
TL;DR
Please help me find a way to make a tellraw clickEvent teleport the player to the entity which executed the tellraw command?
Do this for all of your armor stands. I believe this is the only way for it to work. It is going to be more command blocks, but I think its the only working one.
/execute @e[type=ArmorStand,name=(insertname)] ~ ~ ~ tellraw @a[score_goto=-1]
{
"selector": "@e[type=ArmorStand,r=1]",
"clickEvent": {
"action": "run_command",
"value": "/tp @p @e[type=ArmorStand,name=(insertname)]"
},
"color":"blue"
}