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
/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}}]}}
/give @s stone{display:{Name:"[\"Test\"]"}}
Hold the stone item in your hand
❌ The villager shows a stone item indicating that they want to tradeTry to trade
✔ It does not work (as expected) because the NBT of the items does not match
Attachments
Comments
Can confirm in 1.19.
The trade seems to be supposed to work; it used to do so fine: MC-153160.
Can confirm in 20w51a.