How to build a villager trading hall with zombie discounts for minecraft 1.19

I have a trading hall to in my Java 1.16.4 world to offload the mountains of raw cod from my guardian farm, but I’ve been having problems with them arbitrarily raising their prices. Some off the odd goings-on include:

  • I zombified and cured all of them three times, resulting in some of them buying 1 cod for an emerald and some of them buying 3. I don’t really understand why the third round of curing didn’t work for some of the villagers, but that’s not my main issue, 3 per emerald is an okay price.

  • After trading, some of the villagers sometimes raise their prices by random amounts, then lower them back to normal after a few days. I know about the supply and demand mechanic, but that doesn’t explain why the effect would be so inconsistent, since I trade with all the villagers that make reasonable offers (think 1-3 cod per emerald).

  • I traded with a few villagers at a slightly higher than normal price (4 per emerald) and now they are refusing to lower their prices even after I leave them alone for a few days or make other trades. Furthermore, they’re also raising prices on trades I never made, so it can’t be supply and demand.

  • None of this is ever an issue with my old trading hall, which just uses Hero of the Village.

I really can’t figure out what’s going on. I even tried looking at the source code to figure out how villagers calculate their prices, but to no avail. The only explanation that’s consistent with how they’re behaving is that zombie villager discounts fade away after a while, but if that were true, wouldn’t it be mentioned on the wiki and/or one of the many videos on trading halls?

Written by Jane