Rerolling Trades to Hunt a Specific Enchanted Book or Item
Set up the villager first
Place the workstation that gives the villager the profession you need — for example, a lectern for a librarian if you want enchanted books. Let the villager claim the block and reach its profession.
Cycle and watch the offer list
Open the trading GUI and use the cycle button or the cycle keybind to reroll offers. Each cycle replaces the current list with a new random set, so keep going until the item you want shows up. For librarians, this means watching for the specific enchanted book you are after; for other professions, watch for the tool, food, or map trade you need.
Lock the trade before moving on
As soon as the desired offer appears, buy it at least once. That trade is then saved and will persist through future restocks. If you want several different books from the same villager, note that cycling rerolls the whole list, so secure one trade before chasing the next. If you run out of patience, you can always cycle again later — the mod does not punish you for rerolling repeatedly, and no emeralds are spent until you actually click a trade.