When the sign is placed, it successfuly displays "/give @p minecraft:player_head{SkullOwner:Eglaios}" (partially hidden but here)
Until now, it's fine. Then I want to copy this in a command block using /data modify, which works, BUT since command blocks' commands are strings, it displays the full JSON text as the sign.
I need a way to translate JSON to string in minecraft vanilla in order to paste the sign's fake command into a command block and make it work successfuly.
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
The data on the signs ( '{"text:"some_text""}' ) is a stringified JSON object. So you would first need to convert the stringified object back into an object and then access the text variable to get the value (which I think is out of the command block scope). By the looks of it, the game does this in the background and displays the extracted value on the sign. Of course, this is just my understanding of how things work and it might not be 100% correct. See this page on the wiki for more info on how data is stored: https://minecraft.gamepedia.com/NBT_format
when I setblock a sign with "selector:@p" as JSON at Text1, it is written "Eglaios", but the sign's Text1 data features name, hoverevent, uuid, etc.
Then, when I copy this data on an item's name, it still displays "Eglaios" and the item name data is still a bunch of values
However, when I place the item in an anvil and add a space after "Eglaios", the item name value is now "{"text":"Eglaios "}"
Well, still so much trouble and not even solving my problem.
As you said, the player name is only a translation of the nbt data. Also, we can not extract the "text" value as JSON are only string values converted by the game... so Text1.text is not a valid path...
Thank you for confirming what I thought... anyway the guy was on a server, he will get an easy plugin for that...
Rollback Post to RevisionRollBack
I got into chiptune music composition.
You can listen to them on my Youtube channel : https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
[SOLVED (impossible until 1.15)]
Hi guys!
A friend of mine asked to make players drop their head at death in vanilla.
I thought about using JSON signs that would display this as Text1 string :
[/text/:"/give @p minecraft:player_head{SkullOwner:"] ; [/selector/:"@p"] ; [/text/:"}"]
When the sign is placed, it successfuly displays "/give @p minecraft:player_head{SkullOwner:Eglaios}" (partially hidden but here)
Until now, it's fine. Then I want to copy this in a command block using /data modify, which works, BUT since command blocks' commands are strings, it displays the full JSON text as the sign.
I need a way to translate JSON to string in minecraft vanilla in order to paste the sign's fake command into a command block and make it work successfuly.
Thank you for your help!
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).
The data on the signs ( '{"text:"some_text""}' ) is a stringified JSON object. So you would first need to convert the stringified object back into an object and then access the text variable to get the value (which I think is out of the command block scope). By the looks of it, the game does this in the background and displays the extracted value on the sign. Of course, this is just my understanding of how things work and it might not be 100% correct. See this page on the wiki for more info on how data is stored: https://minecraft.gamepedia.com/NBT_format
Command block engineer // Developer // #TeamTrees
Yeah, I thought too.
The only thing I found was this :
when I setblock a sign with "selector:@p" as JSON at Text1, it is written "Eglaios", but the sign's Text1 data features name, hoverevent, uuid, etc.
Then, when I copy this data on an item's name, it still displays "Eglaios" and the item name data is still a bunch of values
However, when I place the item in an anvil and add a space after "Eglaios", the item name value is now "{"text":"Eglaios "}"
Well, still so much trouble and not even solving my problem.
As you said, the player name is only a translation of the nbt data. Also, we can not extract the "text" value as JSON are only string values converted by the game... so Text1.text is not a valid path...
Thank you for confirming what I thought... anyway the guy was on a server, he will get an easy plugin for that...
I got into chiptune music composition.
You can listen to them on my Youtube channel :
https://www.youtube.com/channel/UCjWYbJGk7nvNDbnCvMlZGkw
Descriptions are in french, you'd just need some google translation copy-paste...
Also made some more or less complicated datapacks, shared here (planetminecraft).