Paper/patches/server/0405-Fix-villager-trading-demand-MC-163962.patch

21 lines
977 B
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2023-06-08 00:58:10 +02:00
index 67f34a1670cb51a3d2aca3140800ad9b92533d84..dc5908374565dd3080679779cbfe7620a4810015 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
2023-06-08 00:58:10 +02:00
@@ -115,7 +115,7 @@ public class MerchantOffer {
2021-06-11 14:02:28 +02:00
}
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
}
public ItemStack assemble() {