diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt index 38599748..aa9f19fa 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/EnchantingTableSupport.kt @@ -134,8 +134,8 @@ class EnchantingTableSupport( cost / maxObtainableLevel.toDouble() } - val levelPart2 = NumberUtils.bias(levelPart1, enchantment.type.highLevelBias) - val levelPart3 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart2) + val levelPart2 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart1) + val levelPart3 = NumberUtils.bias(levelPart2, enchantment.type.highLevelBias) val level = ceil(levelPart3 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt() multiplier /= this.plugin.configYml.getDouble("enchanting-table.reduction") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt index 0debbd99..d106f5d8 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/VillagerSupport.kt @@ -76,8 +76,8 @@ class VillagerSupport( val maxLevel = enchantment.maximumLevel val levelPart1 = event.recipe.ingredients[0].amount / 64.0 - val levelPart2 = NumberUtils.bias(levelPart1, enchantment.type.highLevelBias) - val levelPart3 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart2) + val levelPart2 = NumberUtils.triangularDistribution(0.0, 1.0, levelPart1) + val levelPart3 = NumberUtils.bias(levelPart2, enchantment.type.highLevelBias) val level = ceil(levelPart3 * maxLevel).coerceIn(1.0..maxLevel.toDouble()).toInt() multiplier /= this.plugin.configYml.getDouble("villager.reduction") diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt index 8e89dbf0..cd04fd05 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/type/EnchantmentType.kt @@ -15,7 +15,7 @@ class EnchantmentType( val id = config.getString("id") val format = config.getString("format") val limit = config.getInt("limit").infiniteIfNegative() - val highLevelBias = config.getDouble("high-level-bias") + val highLevelBias = config.getDouble("high-level-bias").coerceAtMost(0.999) val noGrindstone = config.getBool("no-grindstone") override fun equals(other: Any?): Boolean {