mojira.dev
MC-66780

Written Books acquire a mysterious "resolved" NBT tag when first opened and keep it forever

Written books seem to have a "resolved" NBT tag when they get opened for the first time. This tag prevents opened written books from stacking with otherwise identical unopened ones, and it appears as an NBT tag in F3+H mode, but /clear commands cannot detect it (when acquiring a hacked written book using /give and putting in the "resolved" tag, /clear detects it perfectly). commands detect it fine. Turns out I wasn't casting properly.

How to reproduce:
1. Create a new creative world (make sure you're in F3+H mode)
2. Make a written book
3. Open your inventory and use pick block to clone the book
4. Open one of the books
5. Hover over the books in the inventory. One stack will have one more NBT tag than the other.

Linked issues

Comments 3

is is supposed to be detectable by the /clear command?

I cannot currently confirm which tag-type is used in-game, but it's likely that you are required to manually define the tag-type within appropriate commands. By the sounds of it, it's a 'byte' type, so you append the value with a 'b' (you can use NBTExplorer to check a proper book though):

/clear @p minecraft:written_book 0 0 {resolved:1b}

If you use /give to provide an item and the tag-type is not automatically assigned, it defaults to 'integer' (same with /clear it seems). This is why your /give works with your /clear; you're providing a new tag called "resolved" with a tag-type of 'integer', which is not the correct type (thus becoming a separate, custom tag). The process is the same with /give, appending the value with the tag-type:

/give @p minecraft:written_book 1 0 {title:"",author:"",pages:["Page 1"],resolved:1b}

I also cannot confirm, but it's possible this tag is checked when parsing JSON content as the book is initially opened, which will fill in certain gaps such as the "score" and "selector" tags. The gaps are not filled upon book creation, but when the book is opened. Opening the book at any other point does not update the data, as the JSON content has been changed to basic strings.

Since I can't confirm this, a possible test somebody else could conduct is the following:

/give @p minecraft:written_book 1 0 {title:"",author:"",pages:["{selector:\"@p\"}"],resolved:1b}

With "resolved" set to 1 (you may need to modify the tag-type if it isn't actually 'byte'), the page should not state your player name once you open the book. I don't know what it would state otherwise though, since I don't have access to the game right now.

If that's not the case, then it's probably just the tag being used for reference to check if the book has been opened or not, which is useful to map makers anyway.

Ely G

(Unassigned)

Confirmed

Minecraft 14w32d

Retrieved