The bug
When opening a resolved book containing malformed text components, e.g. value of text
not being a string, on a lectern, the game crashes.
19w03c: [^crash-2019-01-19_22.07.59-client.txt]
Description: Rendering screen
java.lang.ClassCastException: com.google.gson.JsonPrimitive cannot be cast to com.google.gson.JsonObject
at com.google.gson.JsonObject.getAsJsonObject(JsonObject.java:191)
at jb$a.a(SourceFile:239)
at jb$a.deserialize(SourceFile:174)
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69)
at yu.a(SourceFile:497)
at yu.a(SourceFile:522)
at jb$a.a(SourceFile:392)
at cvm$c.a(SourceFile:103)
at cvm$a.b(SourceFile:46)
at cvm.a(SourceFile:284)
at dfb.a(SourceFile:800)
at cqe.d(SourceFile:931)
at cqe.b(SourceFile:407)
at net.minecraft.client.main.Main.main(SourceFile:154)
How to reproduce
Place a lectern with a malformed book
/setblock ~ ~ ~ lectern[has_book=true]{Book:{id:written_book,Count:1b,tag:{title:title,author:author,pages:["{\"text\":{}}"],resolved:1b}}}
Open the book on the lectern
→ ❌ The client crashes
Attachments
Comments 7
You don't have to remove a report, we will just close it, but it will remain visible.
Could you please provide the exact commands which caused the crash anyways? Minecraft should likely not crash when you provide incorrect NBT data.
Hey thanks for respond.
data merge block ~ ~1 ~ {Book:{id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"swasd\"}"]}}}
with this command u can change alle json types without any problems.
If you want to show a score in the book wich is actually working if you use the give command the game crashes.
data merge block ~ ~1 ~ {Book:{id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"papa\"}","{\"score\":\"@p\",\"objective\":\"test\",\"value\":\"\"}"]}}}
this command works but it crashs the game. (it isnt 100% correct ik but the game run the command)
data merge block ~ ~1 ~ {Book:{id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"papa\"}","{\"score\":{\"name\":\"@p\",\"objective\":\"test\",\"value\":\"\"}}"]}}}
this also cause crash (i guess thats the rigth syntax at the moment i do not find the right one)
i can say in any version of the command whne the "score" tag is implemented the game crash's
The problem is that it works via give command cause it reads the actual score. if you change it via data merge command i guess it crash cause it cant get the value. hardcoded problem.
If you have any question i'll answer them. It's hard to describe the circumstances.
Hmm, weird I am not able to reproduce the crash. Can you please attach the crash report.
And could please provide all commands you used, including setting up scoreboards, placing the lectern.
the lecter stands on top of a command
with this command inside
data merge block ~ ~1 ~ {Book:{id:"minecraft:written_book",Count:1b,tag:{pages:["{\"text\":\"papa\"}","{\"score\":\"@p\",\"objective\":\"test\",\"value\":\"\"}"]}}}
scoreboard commands
/scoreboard objectives add test dummy "test"
/scoreboard players add @a test 1
i use a writable book write test in it. signed it and lay it on the lecter.
power the command block and open the lecter.
Thank you very much, it appears that in general malformed text components, including your case with a string as score
component value, in resolved books cause the crash. I updated the report accordingly.
I dont know how to remove an bug report. I solved the problem by using an other command.