Paper/Spigot-Server-Patches/0489-Fix-villager-trading-demand-MC-163962.patch
Riley Park 4e958e229f
We're going on an Adventure! (#4842)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-02-21 20:45:33 +01:00

21 lines
916 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/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java
index 2865fa7018c3631fbcaaaaa2892219d9cab713d3..e42382a5c385c27b6322b03e87870eb20b21cb22 100644
--- a/src/main/java/net/minecraft/server/MerchantRecipe.java
+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java
@@ -104,7 +104,7 @@ public class MerchantRecipe {
}
public void e() {
- 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 f() {