mojira.dev
MC-266958

Written book target selectors break when cheats are disabled

When a player in a singleplayer world with cheats enabled runs a command (through a command block or /trigger for consistency) which in any way generates a written book or modifies written book data to contain target selectors (or scores using target selectors), the book works as intended. However if cheats are disabled, the book instead prints the given data directly onto the pages.

Example command (put this in a command block then enable/disable cheats to confirm):
give @p written_book{author:"Server",title:"Test",pages:['["",{"text":"good day
n"}{"selector":"@p"}]']}

I found this while trying to code a custom written book to modify your stats in a datapack. I also tested through regular commands and command blocks and trigger commands in both creative and survival modes with cheats enabled and disabled.

Linked issues

Comments 2

Fair, sorry. I missed that report

Snowytags

(Unassigned)

Unconfirmed

(Unassigned)

1.20.2

Retrieved