Add work type option for config gui.

Removed some useless function for setting guis.
fix work penalty increase_only not working.
This commit is contained in:
alexcrea 2024-09-01 16:45:16 +02:00
parent 519ab1853c
commit ce01702cea
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
16 changed files with 400 additions and 151 deletions

View file

@ -86,17 +86,13 @@ object AnvilXpUtil {
// Extracted From https://minecraft.fandom.com/wiki/Anvil_mechanics#Enchantment_equation
// Calculate work penalty
val penaltyType = ConfigOptions.workPenaltyType;
val leftPenalty =
if(!penaltyType.isPenaltyAdditive) 0
else {
(left.itemMeta as? Repairable)?.repairCost ?: 0
}
val leftPenalty = (left.itemMeta as? Repairable)?.repairCost ?: 0
val rightPenalty =
if (right == null || !penaltyType.isPenaltyAdditive) 0
else {
(right.itemMeta as? Repairable)?.repairCost ?: 0
}
if (right == null) 0
else (right.itemMeta as? Repairable)?.repairCost ?: 0
// Increase penalty on fusing or unit repair
if(penaltyType.isPenaltyIncreasing && (right != null || unitRepair)){
@ -114,6 +110,8 @@ object AnvilXpUtil {
"result penalty: ${(result.itemMeta as? Repairable)?.repairCost ?: "none"}"
)
if(!penaltyType.isPenaltyAdditive) return 0
return leftPenalty + rightPenalty
}