mojira.dev
MC-167040

Villager shows item in hands that it can't actually sell because of NBT

The bug

Villagers showing the item they want to trade ignore the NBT data, even though it is checked when trading.

This means a villager can indicate that it wants to trade by holding an item even though the trade is not possible.

Just to be clear, I don't want/expect that non-matching custom tags can still be traded with, I just want the villager not to show the item being sold in it's hands if an item with non-matching tags is held.

How to reproduce

  1. /summon villager ~ ~ ~ {VillagerData:{profession:"minecraft:nitwit"},Offers:{Recipes:[{maxUses:100,buyB:{id:stone,Count:1b},buy:{id:stone,Count:1b},sell:{id:stone,Count:1b}}]}}
  2. /give @s stone{display:{Name:"[\"Test\"]"}}
  3. Hold the stone item in your hand
    ❌ The villager shows a stone item indicating that they want to trade

  4. Try to trade
    ✔ It does not work (as expected) because the NBT of the items does not match

Attachments

Comments

migrated
[media]
Avoma

Can confirm in 20w51a.

Avoma

Can confirm in 1.19.

user-f2760

The trade seems to be supposed to work; it used to do so fine: MC-153160.

Bertie

(Unassigned)

Confirmed

(Unassigned)

1.14.4, 1.15.2 Pre-release 2, 20w51a, 1.19

Retrieved