-
Bug
-
Resolution: Awaiting Response
-
None
-
1.21 Pre-Release 2
-
Unconfirmed
-
(Unassigned)
I was attempting to create a datapack function for displaying held item in chat and ran into a following incompatiblity with using macros in tellraw.
My setup is the following:
showitem.mcfunction:
$tellraw @a[distance=..16] [{"text":"$(id)","hoverEvent":{"action":"show_item","contents":{"id":"$(id)","count":"$(count)","components":$(components)}}}]
command:
function test:showitem with entity @s SelectedItem
Running the above command throws the following error:
caused error: Invalid chat component: Use JsonReader.setLenient(true) to accept malformed JSON
To see what the macro was turning into I changed the function to use say command instead and this is the returned json:
[{"text":"minecraft:written_book","hoverEvent":{"action":"show_item","contents":{"id":"minecraft:written_book","count":"1","components":{"minecraft:written_book_content":{author:"Lare",generation:3,title:{raw:""}}}}}}]
Whatever the macro inserted in the components isn't in the strict JSON format and hence is not compatible with tellraw.