From 2898b4a7eb7c477e57a6ce1ff47c1642d181186e Mon Sep 17 00:00:00 2001 From: chickeneer Date: Fri, 5 Jun 2020 20:02:04 -0500 Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity --- .../world/item/trading/MerchantOffer.java.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/world/item/trading/MerchantOffer.java.patch b/paper-server/patches/sources/net/minecraft/world/item/trading/MerchantOffer.java.patch index a199c6a05a..b2a328fe58 100644 --- a/paper-server/patches/sources/net/minecraft/world/item/trading/MerchantOffer.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/item/trading/MerchantOffer.java.patch @@ -29,6 +29,15 @@ private MerchantOffer(ItemCost firstBuyItem, Optional secondBuyItem, ItemStack sellItem, int uses, int maxUses, boolean rewardingPlayerExperience, int specialPrice, int demandBonus, float priceMultiplier, int merchantExperience) { this.baseCostA = firstBuyItem; this.costB = secondBuyItem; +@@ -110,7 +124,7 @@ + } + + public void updateDemand() { +- this.demand = this.demand + this.uses - (this.maxUses - this.uses); ++ this.demand = Math.max(0, this.demand + this.uses - (this.maxUses - this.uses)); // Paper - Fix MC-163962 + } + + public ItemStack assemble() { @@ -185,7 +199,11 @@ if (!this.satisfiedBy(firstBuyStack, secondBuyStack)) { return false;