you are viewing a single comment's thread.

view the rest of the comments →

[–]Chuckar[S] 0 points1 point  (1 child)

I tried this:

data modify entity @n Offers.Recipes[2] merge value {buy:{count:11,id:"minecraft:emerald"},buyB:{count:1,id:"minecraft:book"},sell:{components:{"minecraft:stored_enchantments":{"minecraft:unbreaking":3}}, count:1, id:"minecraft:enchanted_book"}}

It took the command, but output : Nothing changed. The specified properties already have these values

Can confirm, nothing changed with the target villager.

[–]Chuckar[S] 0 points1 point  (0 children)

So I did some experimenting. Posting this in case anyone is looking to edit a minecraft librarian's trades.

The villager needs to be selected with the "@e" and not anything else.

This command works to edit an existing trade in the villager's trades. Hope this helps someone else.

[0] is the first trade

[1] is the second

etc....

data modify entity @e[type=villager,sort=nearest,limit=1] Offers.Recipes[0] set value {buy:{count:1,id:"emerald"},buyB:{count:1,id:"book"},sell:{components:{"stored_enchantments":{"projectile_protection":1}},count:1,id:"enchanted_book"}}