mojira.dev
MC-311094

Villager discounts do not apply until the trading window is closed and reopened

The bug

If a villager decides to discount its trades while trading due to increased player reputation or the hero of the village effect, the discounts are not available right away until the menu is closed and reopened. After the fix of MC-310787, players are more likely to keep the trading window open for longer, and so may miss out on discounts that they are entitled to.

How to reproduce

  1. Spawn a villager

  2. Get lots of emeralds

  3. Trade with it for a while without closing the menu

  4. Close the menu and reopen it

Expected results

The discounts should have appeared while you were trading

Observed results

They didn’t appear until you closed and reopened the menu

Notes

Another way to reproduce this is to give yourself the hero of the village effect with a delayed command block.

As @clamlol pointed out, villagers can restock while trading, and the trades and prices do update in that case without needing to close and reopen the window.

Linked issues

Attachments

Comments 3

Can also confirm. For testing with Hero of the Village, the following command may be helpful: /give @s minecraft:splash_potion[minecraft:potion_contents={custom_color:9502593,custom_effects:[{id:"hero_of_the_village",amplifier:0b,duration:2000}]},minecraft:custom_name={text:"Potion of Heroism",italic:0b}]

Also, villagers can work at their job site block while trading if they are already in range of it, and it seems like prices are updated when they do:

tryashtar

etanaratsastaja

Confirmed

26.2, 26.3 Snapshot 8

26.3 Snapshot 10

Retrieved