Java Edition:Any NBT Book
When written books were first added to Minecraft, they had a severe flaw in their server side logic to check against potentially malicious client input. This flaw allows one to place nearly any NBT they desire onto a book and quill or written book.
Obtaining
This requires a modified client to create, but it will work on any vanilla server. The client must modify the book GUI class to send a custom book update packet containing the NBT one wishes to place into the book.
The Flaw
When a client needs to update the contents of a book to the server, it does so by serializing an ItemStack containing the relevant book NBT tags, which are pages, author, and title. The server will then deserialize this ItemStack, and will perform some checks on the data. These checks are as follows:
- The player is holding a book and quill in their hand server-side
- The deserialized
ItemStackis either a written book or a book and quill - The deserialized
ItemStackhas NBT data - The deserialized
ItemStackhas thepageslist tag - For each string tag within the
pageslist tag, it is not null and has no more than 256 characters - The deserialized
ItemStackhas thetitletag, and it has no more than 16 characters - The deserialized
ItemStackhas theauthortag
If all of these checks passed, then the deserialized ItemStack's root tag would be copied to the server-side item. The flaw is that the client may send other NBT tags in this root tag, such as the ench tag, which will be applied to the server-side item when the checks pass. The server also does not validate the author tag beyond it existing, so any author may be provided.
Clients
Here are some existing clients one can use to create these books to various extents:
| Any NBT Book Clients | ||
|---|---|---|
| Mod | Versions | Scope |
| BookMod | 1.3, 1.3.1, 1.3.2, 1.4, 1.4.1, and 1.4.2 | Can create any NBT and has easy support for enchantments, attributes, lore, author, color formatting, and other useful item tags. |
| EnchantedSigning | 1.4, 1.4.1, 1.4.2 | Can create any enchantments and any author tag. |
Copies
Written books may be copied in 13w36a (a 1.7.2 snapshot) and above by crafting them with a book and quill. 14w05a (a 1.8 snapshot) added the generation tag, which increases by one each time the book is copied. The three variants that can be created are "Original", "Copy", and "Copy of a Copy". Books that are a copy of a copy cannot be copied further. All books created before this point and newly signed books will be considered original.
Copying a book also copies all of its NBT data, not just the data intended to be applied to written books.
Uses
As one can specify nearly any NBT tag they desire, one can apply many useful or interesting tags:
- Any enchantment at any level, including those that don't exist in 1.3/1.4 (must be from before numerical IDs were phased out in the flattening)
- Any custom attribute, such as luck, movement speed, or attack damage
- Any author, such as the entire script of the Bee Movie
- Any name via the
displaytag - Lore!
- Tattered books
- "Unbreakable" books
- Books with hidden attributes via the
HideFlagstag - Specify data in the
CanDestroytag for adventure mode - Any other silly useless tags, such as
discontinued:1b
One particularly interesting use for these books is in combination with the item replacement mechanic available in the April Fool's snapshot 23w13a_or_b, which can allow one to place any existing NBT onto any item they desire. Using this method in combination with the item replacement vote also lets one not have to manually craft complex NBT structures and lets one access the normally inaccessible array tag types, which allows for custom attributes on any item.
See Also
- Java Edition:Items
- Java Edition:Item Data
- Java Edition:Enchantments
- Java Edition:Duplicate Enchantments
- Java Edition:Incompatible Enchantments
- Java Edition:Multiplayer
- Java Edition:Singleplayer
- Java Edition:Release
- Java Edition:Replicable
- Java Edition:Unintentional
- Java Edition:Movable
- Java Edition:Directly Observable
- Java Edition:Indirectly Observable
- Java Edition:Permanent
- Java Edition:Current
- Java Edition:Modified Client