Survival reproduction
Shortly after sunrise, obtain a fresh librarian offering an enchanted book. Do not cure or previously damage it.
Complete 13 individual paper trades with it. Wait at least one game tick between trades; do not shift-click them together.
Close the interface. The librarian now has exactly +25 reputation toward you.
Carry exactly the displayed discounted enchanted-book payment: emeralds plus one book.
Throw an egg upward on a delayed trajectory toward the villager.
Quickly open trading, select the enchanted-book offer and let the inputs autofill.
Wait for the egg to hit. The displayed cost rises.
You receive the enchanted book, while the emeralds and book remain. The offer’s use count does not increase, although the villager receives trade XP.
Expected: The output should disappear once the existing payment becomes insufficient.
Root cause
Thirteen trades produce min(13 × 2, 25) = +25; one hit adds −25, producing exactly zero.
Pre-Release 2 resets the previous discount but refreshes the output only when the new reputation is nonzero.
// net/minecraft/world/entity/npc/villager/Villager.java
// private void updateSpecialPrices(final Player player)
if (reputation != 0) {
offer.addToSpecialPriceDiff(-Mth.floor(reputation * offer.getPriceMultiplier()));
offersChanged = true;
}Therefore, zero removes the five-emerald enchanted-book discount without invalidating the result. The result-slot handler then fails to consume the now-insufficient payment but never rolls back the obtained item.
POC
Linked issues
relates to 2
Comments 0
No comments.