mojira.dev
MC-116762

Advancement command rewards using NBT data causes advancement to error (I.E. Tellraw, give, summon)

Using a custom advancement that uses custom NBT code such as Tellraw, give, or summon causes the advancement to error and not show up in-game. For example:

If I have the following code:

{
   "criteria": {
      "test": {
         "trigger": "minecraft:impossible"
         }
      },
   "rewards": {
      "commands": [
         "give @p diamond 1"
         ]
   }
}

The code above does work as the player will receive a diamond upon the advancement being granted. However the following code does not work if the command contains NBT data:

{
   "criteria": {
      "test": {
         "trigger": "minecraft:impossible"
         }
      },
   "rewards": {
      "commands": [
         "give @p diamond 1 0 {display:{Name:"test"}}"
         ]
   }
}

Other commands that are completely unusable by this is Tellraw as it doesn't work with command that work if used in a command block, but not through the advancement:

tellraw @a [{"selector":"@p"},{"text": " has just earned the advancement ","extra":[{"text":"[A test!]","color": "green","hoverEvent":{"action":"show_text","value":["",{"text":"A test\n","color":"green","underlined":true},{"text":"Advancement\n","color":"gray","italic":"true"},{"text":"Time to start the real fun stuff!","reset":"true"}]}}]}]

The code above if placed in a command block will work, but if placed in an advancement, will not work. Even if the tellraw is simplified to a basic message

tellraw @a {"text":"test"}

The target selector doesn't seem to cause any problem, they work as intended for instances such as /give and /say.

A list of commands possibly effected by this and wont work:

/title
/tellraw
/say
/summon (if using NBT)
/give (if using NBT)
/setblock
/fill
/scoreboard (if testing for NBT)
/testfor (if testing for NBT)
and much more

Linked issues

Comments 1

You need to escape your nested quotes.

Littleman9Mew2

(Unassigned)

Unconfirmed

Minecraft 17w17b

Retrieved