A small Fabric mod for Minecraft 1.21.1. Identical enchanted books stack up to 16 instead of 1 — you can raise or lower that limit in the config.
Enchanted books that are actually identical (same enchantments, same levels, same anvil work penalty, same custom name, same everything else) pile up in your inventory and shulker boxes like any other item. Books that differ in any way still take separate slots, exactly like vanilla.
Two enchanted books stack together only when the game itself considers them
the exact same item: ItemStack.isSameItemSameComponents. In practice that
means the same stored enchantments at the same levels, the same anvil repair
cost, the same custom name, and any other component matching. A Sharpness I
book will never stack with a Sharpness II book or with an Unbreaking I
book. The mod doesn't add any merging logic beyond what vanilla already
checks for "is this the same item".
Vanilla assumes every enchanted book has a count of 1. Without extra care, letting books stack would mean losing whole stacks to a single anvil pull or duplicating them in creative mode. This mod changes the relevant vanilla code paths so stacks are always handled one book at a time:
| Situation | Result |
|---|---|
| Anvil, book stack in the right slot (e.g. sword + 16 books) | exactly 1 book is used per operation, not the whole stack |
| Anvil, book stack in the left slot with something to combine on the right | worked one book at a time, at the normal single-book XP cost; taking the result removes 1 book from each stack, and a shift-click takes only one result |
| Anvil, book stack in the left slot, right slot empty (renaming) | unchanged — the whole stack is renamed and returned together, same as renaming any other item stack |
| Grindstone, a single book stack with the other slot empty | 1 disenchanted book at a time; a shift-click grinds the stack one book at a time, each for that one book's XP |
| Grindstone, book stack next to another item | no result, same as vanilla |
| Grindstone, two identical single books | vanilla's normal stackable-item path: 2 books in, 2 plain books out |
Everything else that touches books — the enchanting table (single-item slot, and enchanted books can't be enchanted anyway), the chiseled bookshelf, lecterns, loot tables, and villager trades — already worked correctly with stackable books and needed no changes.
The mod creates config/stackable_enchanted_books.json on first launch:
{
"maxStackSize": 16
}
| Key | Default | Valid values |
|---|---|---|
maxStackSize |
16 |
whole numbers 1–64 (1 keeps vanilla behavior) |
16. The mod never rewrites or
"fixes" your file for you.Enchanted books stack up to 16.This mod changes a default item component, which isn't something the
network syncs between client and server. Install it on the server and on
every client, using the same maxStackSize.
If a client and server end up mismatched anyway (nothing prevents it — the mod adds no registry entries or packets to check for), here's what actually happens, verified against the 1.21.1 source:
AnvilMenu,
GrindstoneMenu, the grindstone result slot, and one hook in
AbstractContainerMenu.broadcastChanges) plus Fabric API's
DefaultItemComponentEvents.