Version 1.4.4:

* Added feature to increase discounts by setting MaxDiscount to a number greater than 1.0
This commit is contained in:
PretzelJohn 2021-12-23 02:17:49 -05:00
parent b950195383
commit 446e677336
5 changed files with 11 additions and 7 deletions

View File

@ -85,7 +85,8 @@
<td>The maximum discount (%) you can get from trading/healing zombie villagers. This limits reputation-based price decreases.<br/><strong>Options:</strong>
<ul>
<li>Set to -1.0 to disable this feature and keep vanilla behavior</li>
<li>Set to a number between 0.0 and 1.0 to set the maximum discount a player can get. (NOTE: 30% = 0.3)</li>
<li>Set to a number between 0.0 and 1.0 to limit the maximum discount a player can get. (NOTE: 30% = 0.3)</li>
<li>Set to a number above 1.0 to increase the maximum discount a player can get. (NOTE: 250% = 2.5)</li>
</ul>
</td>
</tr>
@ -139,11 +140,11 @@
</tr>
<tr>
<td><code>.Item1.Material:</code><br><code>.Item2.Material:</code></td>
<td>Sets the material of the 1st or 2nd item in the trade</td>
<td>Sets the material of the 1st or 2nd item in the trade<br><strong>WARNING:</strong> This cannot be undone!</td>
</tr>
<tr>
<td><code>.Item1.Amount:</code><br><code>.Item2.Amount:</code></td>
<td>Sets the amount of the 1st or 2nd item in the trade</td>
<td>Sets the amount of the 1st or 2nd item in the trade<br><strong>WARNING:</strong> This cannot be undone!</td>
</tr>
</table>
</li>

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.pretzel.dev</groupId>
<artifactId>VillagerTradeLimiter</artifactId>
<version>1.4.3</version>
<version>1.4.4</version>
<properties>
<java.version>1.8</java.version>

View File

@ -126,7 +126,7 @@ public class PlayerListener implements Listener {
for(final NBTCompound recipe : recipes) {
final int ingredientAmount = recipe.getCompound("buy").getInteger("Count");
final float priceMultiplier = this.getPriceMultiplier(recipe);
final int valueModifier = 5 * majorPositiveValue + minorPositiveValue + tradingValue - minorNegativeValue - 5 * majorNegativeValue;
final int valueModifier = (5 * majorPositiveValue) + minorPositiveValue + tradingValue - minorNegativeValue - (5 * majorNegativeValue);
final float finalValue = ingredientAmount - priceMultiplier * valueModifier;
boolean disabled = false;
@ -174,6 +174,8 @@ public class PlayerListener implements Listener {
} else {
recipe.setFloat("priceMultiplier", priceMultiplier);
}
} else if(maxDiscount > 1.0) {
recipe.setFloat("priceMultiplier", priceMultiplier * (float) maxDiscount);
} else {
recipe.setFloat("priceMultiplier", priceMultiplier);
}

View File

@ -20,7 +20,8 @@ MaxHeroLevel: 1
# The maximum discount (%) you can get from trading/healing zombie villagers. This limits reputation-based price decreases.
# * Set to -1.0 to disable this feature and keep vanilla behavior
# * Set to a number between 0.0 and 1.0 to set the maximum discount a player can get. (NOTE: 30% = 0.3)
# * Set to a number between 0.0 and 1.0 to limit the maximum discount a player can get. (NOTE: 30% = 0.3)
# * Set to a number above 1.0 to increase the maximum discount a player can get. (NOTE: 250% = 2.5)
MaxDiscount: 0.3
# The maximum demand for all items. This limits demand-based price increases.

View File

@ -1,7 +1,7 @@
name: VillagerTradeLimiter
author: PretzelJohn
main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter
version: 1.4.3
version: 1.4.4
api-version: 1.14
commands: