mojira.dev
MC-132163

Selector with Item NBT Fails if Item Name is Stylized

I've tried this is pre2 and pre4, fails in both.

If I run a scoreboard command targeting players who have flint in their inventory with the Name of "TestFlint", it fails if that item has a stylized name (shown below). If I remove the color and italics, it seems to work fine. I've tried selecting by Name using the stylizing portions of the /give command as well, with no results.

# paste into command block
# indents shown here to help with code visibility
# does not work
give @p minecraft:flint{
	display:{
		Name:"{\"text\":\"TestFlint\",\"color\":\"blue\",\"italic\":true}"
	}
} 1
# paste into command block
# indents shown here to help with code visibility
# works
give @p minecraft:flint{
	display:{
		Name:"{\"text\":\"TestFlint\"}"
	}
} 1
# look for players holding TestFlint and increment their score
scoreboard players add @a[nbt={SelectedItem:{id:"minecraft:flint",Count:1b,tag:{display:{Name:"{\"text\":\"TestFlint\"}"}}}}] test 1

Comments 2

NBT has to match exactly, the value of Name is not without the ,\"color\":\"blue\",\"italic\”:true

Ah. Uh, sorry. I was just corrected on MCForum as well. That value is inputted as a string. Hadn't looked at it that way.

Daniel W Scutt

(Unassigned)

Unconfirmed

Minecraft 1.13-pre4

Retrieved