I used a /replaceitem command to give the player a book which had json text in showing the items in the world and a sentence that could be clicked which would run the command: /kill @e[type=Item]
it worked fine until I clicked the command sentence then it ran the command and closed the book. When I opened it again it showed the raw json instead of the text it showed before and only stopped doing this when I dropped the book and got a new one using the same command.
the command to get the book is:
/replaceitem entity @a slot.hotbar.0 written_book 1 0 {pages:["{\"text\":\"\",\"extra\":[{\"text\":\"all items in this world: \"},{\"selector\":\"@e[type=Item]\"},{\"text\":\" to remove them click here\",\"underlined\":\"true\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/kill @e[type=Item]\"}}]}"],title:Items,author:Anon}
(the command was running on a loop)
Linked issues
duplicates 1
Attachments
Comments 4
I looked over the json again and saw that there was nothing wrong. Whoops. 😞 Just thought that might be the case because raw json is what you see if you get it wrong. But I tested it myself, and the bug does only seem to occur when you try to replace the item, but the item is already in that hotbar slot. Removing the book from your inventory before you run the command again will give you the correct book.
Unable to reproduce. I suspect you had it wrong originally and then MC-59144 was to blame.
This is not a bug. Your JSON is invalid.