mojira.dev
MC-269289

Cannot give written_book to player, it gets broken

Create a new written book the usual way, writing in a book. Suppose the book looks like this, from my inventory:

{components: {"minecraft:written_book_content": {pages: [{text: '"Hi"'}], author: "BlueMeanial", title: {text: "Fred"}, resolved: 1b}}, count: 1, Slot: 0b, id: "minecraft:written_book"}

I want to give a player a book just like this. So I say

/give @s minecraft:written_book{"minecraft:written_book_content": {pages: [{text: '"Hi"'}], author: "BlueMeanial", title: {text: "Fred"}, resolved: 1b}}

The book the user receives doesn't work. It looks like this:

{components: {"minecraft:custom_data": {"minecraft:written_book_content": {pages: [{text: '"Hi"'}], author: "BlueMeanial", title: {text: "Fred"}, resolved: 1b}}}, count: 1, Slot: 1b, id: "minecraft:written_book"}

Note the wrapping "minecraft:custom_data" node. Obviously the received book won't work.

Linked issues

Comments 2

That's the wrong syntax. Outside curly braces are now just used for custom data that you can store on an object (hence the wrapping "minecraft:custom_data" node). Item properties have been migrated to components and the syntax uses square brackets. The proper command is written the following:

/give @s minecraft:written_book[minecraft:written_book_content={pages:[{text:'"Hi"'}],author:"EpicGamerX125",title:{text:"Hello World"},resolved:1b}]

Thanks! Is there a writeup on this that I missed? I've read most of the snapshot release notes, but didn't catch this.

kcrca

(Unassigned)

Unconfirmed

(Unassigned)

24w10a

Retrieved