mojira.dev
MC-313172

click_event and hover_event spill into other sections of text unless explicitly overwritten

Issue:
When a click_event or hover_event is defined in the first section of a Text Component, they persist. There is no way to ‘unset’ either so they exist up until they are next defined.

Example:

/give @p written_book[written_book_content={title:"",author:"",pages:[[{"text":"CLICK HERE","color":"dark_blue","bold":true,"underlined":true,"hover_event":{"action":"show_text","value":[{"text":"Hi"}]},"click_event":{"action":"run_command","command":"tellraw @s Hi"}},{"text":" or don't, it's up to you.","color":"black","bold":false,"underlined":false}]]}] 1

The above code gives the player a book that is supposed to say “Hi” when they click on the “CLICK HERE” portion of text. However, you can click any part of that text will trigger the command. As seen in the screenshot, the “Hi” tooltip is nowhere near the area it’s defined.

Reason:
I believe this is due to the Text Component treating Lists as {text: "A", extra: ["B", "C"]}.

Workaround:
Adding an empty text section at position 0 of the List makes future sections behave normally.

Attachments

Comments 2

Thank you for helping us improve Minecraft! We saved your files:

[media]

Your reason is correct, and is why this is not a bug. The workaround is acceptable, or you could structure your nesting explicitly instead of using the list shorthand.

Sobekan

(Unassigned)

Unconfirmed

26.4 Snapshot 7

Retrieved