mojira.dev
MC-156027

NBT tags no longer support strings when spawning entities.

Unable to spawn entities with `CustomName` due to JSON parser incorrectly parsing NBT data object.

 

When attempting the following:

execute at @a run summon minecraft:parrot ~1 ~1 ~1 { "CustomName": "TEST", "CustomNameVisible": 1 }

The following error is thrown:

Exception loading entity:
m: Loading entity NBT
at ail.f(SourceFile:1592) ~[vanilla-1.14.3.jar:?]
at aip.a(SourceFile:432) ~[vanilla-1.14.3.jar:?]
at p.a(SourceFile:327) ~[vanilla-1.14.3.jar:?]
at aip.a(SourceFile:431) ~[vanilla-1.14.3.jar:?]
at aip.b(SourceFile:484) ~[vanilla-1.14.3.jar:?]
at aip.a(SourceFile:465) ~[vanilla-1.14.3.jar:?]
at tp.a(SourceFile:66) ~[vanilla-1.14.3.jar:?]
at tp.a(SourceFile:46) ~[vanilla-1.14.3.jar:?]
at com.mojang.brigadier.CommandDispatcher.execute([CommandDispatcher.java:262|http://commanddispatcher.java:262/]) [vanilla-1.14.3.jar:?]
at com.mojang.brigadier.CommandDispatcher.execute([CommandDispatcher.java:176|http://commanddispatcher.java:176/]) [vanilla-1.14.3.jar:?]
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
at com.google.gson.internal.Streams.parse(Streams.java:60) ~[vanilla-1.14.3.jar:?]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:65) ~[vanilla-1.14.3.jar:?]
at zp.a(SourceFile:493) ~[vanilla-1.14.3.jar:?]
at zp.a(SourceFile:518) ~[vanilla-1.14.3.jar:?]
at jn$a.a(SourceFile:393) ~[vanilla-1.14.3.jar:?]
at ail.f(SourceFile:1567) ~[vanilla-1.14.3.jar:?]
... 15 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[vanilla-1.14.3.jar:?]
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[vanilla-1.14.3.jar:?]
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:593) ~[vanilla-1.14.3.jar:?]
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[vanilla-1.14.3.jar:?]
at com.google.gson.internal.Streams.parse(Streams.java:46) ~[vanilla-1.14.3.jar:?]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:65) ~[vanilla-1.14.3.jar:?]
at zp.a(SourceFile:493) ~[vanilla-1.14.3.jar:?]
at zp.a(SourceFile:518) ~[vanilla-1.14.3.jar:?]
at jn$a.a(SourceFile:393) ~[vanilla-1.14.3.jar:?]
at ail.f(SourceFile:1567) ~[vanilla-1.14.3.jar:?]
... 15 more

 

However, if you replace "TEST" with a number, for example:

execute at @a run summon minecraft:parrot ~1 ~1 ~1 { "CustomName": 1, "CustomNameVisible": 1 }

 

The entity is spawned with its entity name as the displayed name (in this case, "Parrot").

Linked issues

Comments 3

Upon further test, this seems to be isolated to `CustomName`. The following works correctly:

execute at @a run summon minecraft:skeleton ~1 ~1 ~1 {HandItems:[{id:"minecraft:bow",Count:1}]}

Not sure if this is expected, but this works:

execute at @a run summon minecraft:skeleton ~1 ~1 ~1 {CustomNameVisible:1,CustomName:"\"Test\"",HandItems:[{id:"minecraft:bow",Count:1}]}

Which given 19w08a's change to quotations, this does not feel consistent. Is this a non-issue, or a bug with the changes in that snapshot?

Ryan Barr

(Unassigned)

Unconfirmed

(Unassigned)

Minecraft 1.14.3

Retrieved