The bug
When a villager wants to buy a tool, it will look for a Damage:0
tag while it should be ignored. Normally obtained tools do not have Damage
ever set to 0 (until after a reload – more information in MC-125880).
Steps to reproduce
Summon a villager which asks for a diamond pickaxe:
/summon villager ~ ~ ~ {Offers:{Recipes:[{uses:0,maxUses:1,buy:{id:diamond_pickaxe,Count:1},sell:{id:emerald,Count:1}}]}}
Get a diamond pickaxe via crafting or the creative inventory
Try to trade
→ ❌ It won’t workGet a diamond pickaxe via
/give @s diamond_pickaxe{Damage:0}
Try to trade
→ ✔ It works
Linked issues
relates to 2
Comments 10
Wow, good catch... I guess nothing in 18w05a has a 'Damage' tag until it's actually damaged, because I have merchants who also sell epic weapons and armor and they didn't trade with me until I did what you did and 'gave' myself items with an initial 'Damage' value set to zero. I wonder if 'tools/weapons/armor don't have a Damage tag when created' is actually the bug?
(whoops, misinterpreted @unknown, sorry for closing.)
Changed the report to reflect the actual issue.
@unknown, the bug was that the villagers accepted only tools with Damage:0
, now they accept every damage value, including zero or the tag isn't even there.
This is not fixed in 1.13-pre2. I think @unknown didn't really understand it, but he ment the right thing. Normal obtained tools still have no Damage
tag and are still not accepted by villagers.
The Recipes
entries still add a Damage
tag with the default value of 0. Changing it so that this tag is ignored would then bring the disadvantages described in MC-349 again.
But it might be difficult to solve since the item NBT data likely has to be converted to an ItemStack
object to be validated, which probably adds the Damage
tag.
I believe the problem here is that the tools the villager is requesting are given a
Damage
value of zero.For most tools,
Damage
is simply absent when fully repaired, but I am able to trade with the villager when running/give @p diamond_pickaxe{Damage:0}