mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-02 11:22:01 +01:00
Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
This commit is contained in:
parent
37b20cd3d4
commit
2898b4a7eb
@ -29,6 +29,15 @@
|
||||
private MerchantOffer(ItemCost firstBuyItem, Optional<ItemCost> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user