mojira.dev
MC-271311

I want to make a trade using unenchanted tools.

Item NBT tag has been changed in 1.20.6 so I can make tool-enchanting trading using

/summon villager ~ ~ ~ {Offers:{Recipes:{buyB:{id:"minecraft:diamond_pickaxe", count: 1, components:{"minecraft:damage": 0, "minecraft:enchantments":{}}},buy:{id:"minecraft:emerald", count: 4},sell: {id:"minecraft:diamond_pickaxe", components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking": 3}}}}}}

When I generate this trade, villager won't take an diamond pickaxe with damage 1.
However villager will use an diamond pickaxe with enchanting Unbreaking 1 for trading.

I want to know how to fix this trade command.

Attachments

Comments 3

Your wish is my command

summon villager ~ ~ ~ {VillagerData:{profession:"librarian"},Xp:1,Offers:{Recipes:[{buyB:{id:"diamond_pickaxe",count:1,components:{damage:0,enchantments:{}}},buy:{id:"emerald",count:4},sell:{id:"diamond_pickaxe",components:{enchantments:{levels:{unbreaking:3}}}}}]}}

It's not super clear exactly what you want here, but here is a 1.20.5 command that makes the villager require an undamaged, unenchanted pickaxe.

Thanks for comment! I want to re-report this command.
Using the command on comment below results the exact villager. Using commands right below -

/summon villager ~ ~ ~ {VillagerData:{profession:"librarian"},Offers:{Recipes:[{buyB:{id:"minecraft:diamond_pickaxe",count:1,components:{"minecraft:damage":0,"minecraft:enchantments":{}}},buy:{id:"minecraft:emerald",count:4},sell:{id:"minecraft:diamond_pickaxe",components:{"minecraft:enchantments":{levels:{"minecraft:unbreaking":3}}}}}]},NoAI:1}

  • results the same villager output. However if I remove NoAI tag, villager will reset instantly.

That's because without EXP or a workstation, the villager loses his job

Hongsi_k

(Unassigned)

Unconfirmed

(Unassigned)

1.20.6

Retrieved