Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-124419

display.Name and CustomName json tags don't work with "selector" or "score" inputs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 18w03b
    • None
    • Windows 10,
      Java 8 (latest version as of 18-01-2018),
      Tested both with or without resource pack and/or datapack (no difference)
    • Unconfirmed

      The ability to add json to item and entity names excited me alot. And I like it alot too, but I found a bug with it that doesn't particularly seem as "intended" to me:

      When using something like

        /give @p cookie{display:{Name:"{\"selector\":\"@p\"}"}}
      

      or

        /summon pig ~ ~ ~ {CustomName:"{\"selector\":\"@s\"}"}
      

      The displayed name will be something like "@p" or "@s" and not the expected result. Which by the way does work for any other json input in the game (/tellraw, /title, in books, etc.)

      For the "score" input something a bit different happens. For something like this:

        /give @p cake{display:{Name:"[{\"text\":\"This cake is awesome, even after \"},{\"score\":{\"name\":\"@p\",\"objective\":\"cakeBites\"}},{\"text\":\" bites!\"}]"}}
      

      The displayed name will be "This cake is awesome even after bites!" whether the players has the objective or not doesn't change it, let alone the value of the players score. The same applies to entity selectors and this issue also occurs with CustomName json tags.
      What's interresting to note is that imputting something like:

        /summon skeleton ~ ~ ~ {CustomName:"{\"score\":{\"name\":\"Dinnerbone\",\"objective\":\"coolness\"}}"}
      

      Also gives the same problem, which probably means that this issue is not caused by the selector issue, since there's no selector used here. (But I'm no dev so I'm not sure of coarse)

      To be sure I also checked for the functionality of the other 'components' of a json string in the display.Name and CustomName tags and it showed something I was not expecting.
      In the theme of json strings and for complete clarity, I formated all of my test results like this:

      testing_capabilities_of_minecraft_name_tag_json.json
      "minecraft json for display.Name and CustomName tags": {
      	"text input": {
      		"working for display.Name": {
      			"text": true,
      			"translate": true,
      			"with": true,
      			"score": false,
      			"selector": false,
      			"keybind": true
      		},
      		"working for CustomName": {
      			"text": true,
      			"translate": true,
      			"with": true,
      			"score": false,
      			"selector": false,
      			"keybind": true
      		}
      	},
      	"text styling": {
      		"working for display.Name": {
      			"color": true,
      			"bold": true,
      			"italic": true,
      			"underlined": true,
      			"strikethrough": true,
      			"obfuscated": true
      		},
      		"working for CustomName": {
      			"color": true,
      			"bold": true,
      			"italic": true,
      			"underlined": true,
      			"strikethrough": true,
      			"obfuscated": true
      		}
      	},
      	"event listeners": {
      		"working for display.Name": {
      			"insertion": true,
      			"clickEvent": true,
      			"hoverEvent": true
      		},
      		"working for CustomName": {
      			"insertion": false,
      			"clickEvent": true,
      			"hoverEvent": false
      		},
      		"note": "event listeners only work for the text printed in chat when referencing an item with the json display.Name or CustomName"
      	},
      	"adding text": {
      		"working for display.Name": {
      			"extra": true,
      			"array structure": true
      		},
      		"working for CustomName": {
      			"extra": true,
      			"array structure": true
      		}
      	}
      }
      

      Okay..
      For people who don't like code :3 this means:
      1. For the display.Name tag everything is working except "selector" and "score",
      this also includes event listeners which actually shouldn't work (but they work only in the chat message referencing the item when doing /give for example)
      2. The same applies to the CustomName tag, but for that one "insertion" and "hoverEvent" aren't working. (the "insertion" argument doesn't replace the standard shift-click event for entities in chat and the "hoverEvent" doesn't show anything extra when hovering over the entity in chat)

      So you can almost basicly do anything with it, except these two ("selector" and "score") which may or may not be intended...

      Ps. If someone really needs it, I can also post some screenshots, but I figured this should be enough information to recreate it yourself.

            Unassigned Unassigned
            pascalos99 pascal anema
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: