The Bug:
Trades that give very high amounts of experience empty the experience bars of villagers instead of leveling them up.
Steps to Reproduce:
Summon a farmer with some experience and a trade that gives a very high amount of experience by using the command provided below.
/summon minecraft:villager ~ ~ ~2 {VillagerData:{profession:"minecraft:farmer"},Xp:1,Offers:{Recipes:[{buy:{id:"minecraft:emerald"},sell:{id:"minecraft:apple"},xp:2147483647}]}}Obtain an emerald and trade it to the farmer for the apple.
Close the trading screen, wait a few seconds, and then reopen it.
Observe if the farmer levels up.
Observed Behavior:
Trades that give very high amounts of experience empty the experience bars of villagers.
Expected Behavior:
Trades that give very high amounts of experience would level up villagers.