Placing a container with bad NBT results on dupe
This issue is caused by/relates to MC-218074
Obs.: it isn't a shulker box issue, but any container that accepts an NBT such as CustomName
As I discovered while recording, it doesn't limit to dispenser, placing manually also duplicates the block. As I can understand, when the exception occurs, the game stops there, and don't run anything after, and so, not removing the item from inventories, adding the NBT to the block, placing only the block with no data.
The fix for MC-218074 prevents MalformedJsonException crash, but the error is still thrown, and this results on the dispenser placing the shulker, but not removing it from it's inventory.
A log has been attached to the issue, you can see the exception on line 12078
The exception thrown when the shulker is placed:
[17:43:15] [Server thread/ERROR]: Error trying to place shulker box at gg{x=-224, y=65, z=-196}
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) ~[gson-2.8.0.jar:?]
at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:65) ~[gson-2.8.0.jar:?]
at agv.a(SourceFile:493) ~[1.17.1-pre3.jar:?]
at agv.a(SourceFile:517) ~[1.17.1-pre3.jar:?]
at os$a.a(SourceFile:365) ~[1.17.1-pre3.jar:?]
at cik.a(SourceFile:36) ~[1.17.1-pre3.jar:?]
at cjp.a(SourceFile:205) ~[1.17.1-pre3.jar:?]
at bou.a(SourceFile:185) ~[1.17.1-pre3.jar:?]
at bou.a(SourceFile:113) ~[1.17.1-pre3.jar:?]
at bou.a(SourceFile:88) ~[1.17.1-pre3.jar:?]
at hk.a(SourceFile:28) ~[1.17.1-pre3.jar:?]
at hg.dispense(SourceFile:15) ~[1.17.1-pre3.jar:?]
at cbk.a(SourceFile:90) ~[1.17.1-pre3.jar:?]
at cbk.a(SourceFile:113) ~[1.17.1-pre3.jar:?]
at cks$a.a(SourceFile:918) ~[1.17.1-pre3.jar:?]
at abr.b(SourceFile:644) ~[1.17.1-pre3.jar:?]
at bxf.b(SourceFile:81) ~[1.17.1-pre3.jar:?]
at abr.a(SourceFile:364) ~[1.17.1-pre3.jar:?]
at net.minecraft.server.MinecraftServer.b(SourceFile:893) ~[1.17.1-pre3.jar:?]
at net.minecraft.server.MinecraftServer.a(SourceFile:833) ~[1.17.1-pre3.jar:?]
at faq.a(SourceFile:96) ~[1.17.1-pre3.jar:?]
at net.minecraft.server.MinecraftServer.x(SourceFile:692) ~[1.17.1-pre3.jar:?]
at net.minecraft.server.MinecraftServer.a(SourceFile:274) ~[1.17.1-pre3.jar:?]
at java.lang.Thread.run(Thread.java:831) [?:?]
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) ~[gson-2.8.0.jar:?]
at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1401) ~[gson-2.8.0.jar:?]
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:593) ~[gson-2.8.0.jar:?]
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[gson-2.8.0.jar:?]
at com.google.gson.internal.Streams.parse(Streams.java:46) ~[gson-2.8.0.jar:?]
... 23 more
Steps to reproduce:
- Run
/give @p white_shulker_box{BlockEntityTag:{CustomName:"ThisIsInvalidJson"}}
- Put it in a dispenser
- Power the dispenser
The shulker is placed but not removed from the dispenser
This happens due to the fact that Gson won't get
"ThisIsInvalidJson"
but
ThisIsInvalidJson
For it to be valid it would have to be
"\"ThisIsValidJson\""
"{\"text\":\"ThisIsValidJson\"}"
'"ThisIsValidJson"'
or
'{"text":"ThisIsValidJson"}'
Some other invalid examples I know:
'ThisIsInvalidJson'
2021-07-01, 04:22 PM
2021-10-14, 05:57 AM
2021-10-14, 05:45 AM
0
1
1.17.1 Pre-release 3, 1.17.1 Release Candidate 1, 1.17.1, 21w37a
-