Paper/patches/unapplied/server/0388-Fix-villager-trading-demand-MC-163962.patch
2024-04-23 13:36:31 -07:00

21 lines
993 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
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
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index a580011cd3b2b7129f2d09f37a3c26cdaafeefe8..7da5c4a45f8fd46fedd4386e0faac57445475e3a 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -130,7 +130,7 @@ public class MerchantOffer {
}
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() {