Librarian's Balance is a Minecraft datapack that integrates custom trading into vanilla, applies a couple of tweaks to loot tables, and runs functions that tweak the trading system. This description will describe most of the features in this datapack in some detail.
Enchanted books are placeable on lecterns. Librarians adapt their enchanted book trade to what's on their lectern. The emerald price gets updated based on two parameters from that book; the best enchantment & the number of enchantments. A simple explanation is below. The logic was written in Python before I ported it over to mcfunction.
With custom trades the uniqueness of enchantments could get lost because anybody could take a copy from their friend and produce as many more as they want. The 'sealed' books system prevents this by nerfing duplicated books, making them unable to be placed on lecterns, so their exclusive purpose is to apply on gear.
Sealed books are designed to keep enchantments valuable throughout a server economy. If a master enchantment book produces sealed variants, it's up to the player how they want to distribute it.
Enchanted books that get sealed fit the description of 'treasure enchantments', which in Minecraft are what you can't get through villagers, not obtainable on an enchantment table, but that you can find as loot in the world. The definition has changed a little bit now but that doesn't matter because to me these are books that are uniquely obtained and exclusive to the players who get them.
Books that are affected by the 'sealed' books system once traded are the following:
One notable exception is Mending. We had Mending as a sealed variant at one point, but because of how necessary it is to the core game and how difficult the datapack makes obtaining it (will talk about this later), it was voted against.
Librarian's Balance makes tweaks to trading to better support the custom trade system and the progression of obtaining enchantments through villagers.
Default Librarian enchanted book trades can only be random up to level 3. Normally this goes up to level 5 which meant you could get the best enchantment books by doing nothing. This change works in conjunction with custom trades so that you have to use enchantment points to combine lower level books in an anvil with librarians on lecterns to work your way up to higher level enchantments, or explore to find one as loot in the world
Mending cannot be obtained through villagers anymore. It is exclusive to two specific locations in the game being Ancient Cities and End Cities. This makes it uniquely obtained and exclusive to the players who get them (a treasure enchantment), and is how I imagine Mending would be implemented in the modern day just like Swift Sneak, Soul Speed or Wind Burst.
The function that runs these filters happens on every villager every time one is right clicked.
Run:
/function libal:config
Alternatively, edit settings.mcfunction
in the folder data > libal > functions
(datapack only). You can view and configure 'sealed books' from here.