mojira.dev
MC-124876

Villagers requesting tools with no damage provided specifically want Damage:0

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

  1. 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}}]}}
  2. Get a diamond pickaxe via crafting or the creative inventory

  3. Try to trade
    → ❌ It won’t work

  4. Get a diamond pickaxe via

    /give @s diamond_pickaxe{Damage:0}
  5. Try to trade
    → ✔ It works

Linked issues

Comments 10

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}

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?

No, it’s not.

(whoops, misinterpreted @unknown, sorry for closing.)

Changed the report to reflect the actual issue.

CreeperMagnet_

Still affects 18w11a.

Still affects 18w19b.

Pierrot Charles

still in 1.13pre-2

Villager still accept tools with Damage:0 in 1.13pre-2

@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.

Jay Eff

coschevi

Confirmed

damage-value, villager, villager-trade

Minecraft 18w05a, Minecraft 18w06a, Minecraft 18w11a, Minecraft 18w19b, Minecraft 18w20c, Minecraft 18w22c, Minecraft 1.13-pre1, Minecraft 1.13-pre2

Minecraft 1.13-pre3

Retrieved