mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Configurable minimum demand for trades
Addresses MC-163962 where villager demand decreases indefinitely. Paper adds a patch to fix this by preventing demand from going below zero. This patch adds a config option to allow the minimum demand to instead be configurable.
This commit is contained in:
@@ -22,6 +22,15 @@
|
||||
this.startTrading(player);
|
||||
}
|
||||
|
||||
@@ -503,7 +_,7 @@
|
||||
|
||||
private void updateDemand() {
|
||||
for (MerchantOffer merchantOffer : this.getOffers()) {
|
||||
- merchantOffer.updateDemand();
|
||||
+ merchantOffer.updateDemand(this.level().purpurConfig.villagerMinimumDemand); // Purpur - Configurable minimum demand for trades
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
--- a/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
+++ b/net/minecraft/world/item/trading/MerchantOffer.java
|
||||
@@ -143,7 +_,12 @@
|
||||
}
|
||||
|
||||
public void updateDemand() {
|
||||
- this.demand = Math.max(0, this.demand + this.uses - (this.maxUses - this.uses)); // Paper - Fix MC-163962
|
||||
+ // Purpur start - Configurable minimum demand for trades
|
||||
+ this.updateDemand(0);
|
||||
+ }
|
||||
+ public void updateDemand(int minimumDemand) {
|
||||
+ this.demand = Math.max(minimumDemand, this.demand + this.uses - (this.maxUses - this.uses)); // Paper - Fix MC-163962
|
||||
+ // Purpur end - Configurable minimum demand for trades
|
||||
}
|
||||
|
||||
public ItemStack assemble() {
|
||||
@@ -2913,6 +2913,7 @@ public class PurpurWorldConfig {
|
||||
public boolean villagerTakeDamageFromWater = false;
|
||||
public boolean villagerAllowTrading = true;
|
||||
public boolean villagerAlwaysDropExp = false;
|
||||
public int villagerMinimumDemand = 0;
|
||||
private void villagerSettings() {
|
||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||
@@ -2935,6 +2936,7 @@ public class PurpurWorldConfig {
|
||||
villagerTakeDamageFromWater = getBoolean("mobs.villager.takes-damage-from-water", villagerTakeDamageFromWater);
|
||||
villagerAllowTrading = getBoolean("mobs.villager.allow-trading", villagerAllowTrading);
|
||||
villagerAlwaysDropExp = getBoolean("mobs.villager.always-drop-exp", villagerAlwaysDropExp);
|
||||
villagerMinimumDemand = getInt("mobs.villager.minimum-demand", villagerMinimumDemand);
|
||||
}
|
||||
|
||||
public boolean vindicatorRidable = false;
|
||||
|
||||
Reference in New Issue
Block a user