From 79f05d0f82198d455e4ceed67db008d463836865 Mon Sep 17 00:00:00 2001 From: alexcrea <42614139+alexcrea@users.noreply.github.com> Date: Mon, 10 Mar 2025 16:40:11 +0100 Subject: [PATCH] Fix major issue with work penalty also update linked wiki page --- src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilXpUtil.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilXpUtil.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilXpUtil.kt index 887748e..03f2cb5 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilXpUtil.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/util/AnvilXpUtil.kt @@ -81,7 +81,7 @@ object AnvilXpUtil { * Also change result work penalty if right item is not null */ fun calculatePenalty(left: ItemStack, right: ItemStack?, result: ItemStack, useType: AnvilUseType): Int { - // Extracted From https://minecraft.fandom.com/wiki/Anvil_mechanics#Enchantment_equation + // Extracted From https://minecraft.wiki/w/Anvil_mechanics#Enchantment_equation // Calculate work penalty val penaltyType = ConfigOptions.workPenaltyPart(useType) val leftPenalty = (left.itemMeta as? Repairable)?.repairCost ?: 0 @@ -95,12 +95,12 @@ object AnvilXpUtil { // Increase penalty on fusing or unit repair if (penaltyType.penaltyIncrease) { result.itemMeta?.let { - (it as? Repairable)?.repairCost = leftPenalty * 2 + 1 + (it as? Repairable)?.repairCost = leftPenalty.coerceAtLeast(rightPenalty) * 2 + 1 result.itemMeta = it } } if (penaltyType.exclusivePenaltyIncrease) { - val resultPenalty = leftExclusivePenalty * 2 + 1 + val resultPenalty = leftExclusivePenalty.coerceAtLeast(rightExclusivePenalty) * 2 + 1 setExclusivePenalty(result, resultPenalty, useType) }