mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
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:
parent
519ab1853c
commit
ce01702cea
16 changed files with 400 additions and 151 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue