How do I give players an enchanted book?
Enchanted books store the enchantments that they're going to pass onto other items slightly differently than normal enchantments actually on an item. Otherwise, the enchantments on the book intended for passing on would be usable (set mobs on fire with a fire aspect book, or get more loot with a fortune book).
Rather than the ench
list, the pass-on enchantments are in a StoredEnchantments
list, everything else is the same.
For 1.13+:
/give @p enchanted_book{StoredEnchantments:[{id:"minecraft:unbreaking",lvl:5s}]}
For previous versions:
/give @p enchanted_book 1 0 {StoredEnchantments:[{id:34s,lvl:5s}]}
Just because I keep forgetting that 1.13 has changed things up a bit and I keep running across this when I lookup how to enchant a book I wanted to add this.
http://mapmaking.fr/give/
/give @p minecraft:enchanted_book{StoredEnchantments:[{id:"minecraft:unbreaking",lvl:5}]} 1
or if you want to use the ID you still can
/give @p enchanted_book{StoredEnchantments:[{id:34,lvl:5}]} 1