Java Edition.png

Java Edition:Any NBT Book

From Minecraft Discontinued Features Wiki
Jump to navigation Jump to search
Any NBT Book Example.png

Java.png
Warning: Modified Client 
This article covers features exclusive to modified clients and covers discontinued features available through them on vanilla servers. Perform at your own risk.

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 ItemStack is either a written book or a book and quill
  • The deserialized ItemStack has NBT data
  • The deserialized ItemStack has the pages list tag
  • For each string tag within the pages list tag, it is not null and has no more than 256 characters
  • The deserialized ItemStack has the title tag, and it has no more than 16 characters
  • The deserialized ItemStack has the author tag

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, 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.

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 display tag
  • Lore!
  • Tattered books
  • "Unbreakable" books
  • Books with hidden attributes via the HideFlags tag
  • Specify data in the CanDestroy tag 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