mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Hacky fix for 1.20.5.
Also: - version up - metric fix (expected as config was changed) - Prepared for long term update system
This commit is contained in:
parent
2861238f58
commit
46ff34deea
7 changed files with 43 additions and 11 deletions
|
|
@ -217,7 +217,7 @@ object ConfigOptions {
|
|||
* Get the given [enchantment]'s limit
|
||||
*/
|
||||
fun enchantLimit(enchantment: Enchantment): Int {
|
||||
val path = "${ENCHANT_LIMIT_ROOT}.${enchantment.enchantmentName}"
|
||||
val path = "${ENCHANT_LIMIT_ROOT}.${getEnchantKey(enchantment)}"
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(path, defaultEnchantLimit)
|
||||
|
|
@ -234,7 +234,7 @@ object ConfigOptions {
|
|||
isFromBook: Boolean
|
||||
): Int {
|
||||
val typeKey = if (isFromBook) KEY_BOOK else KEY_ITEM
|
||||
val path = "${ENCHANT_VALUES_ROOT}.${enchantment.enchantmentName}.$typeKey"
|
||||
val path = "${ENCHANT_VALUES_ROOT}.${getEnchantKey(enchantment)}.$typeKey"
|
||||
return CustomAnvil.instance
|
||||
.config
|
||||
.getInt(path, DEFAULT_ENCHANT_VALUE)
|
||||
|
|
@ -242,6 +242,13 @@ object ConfigOptions {
|
|||
?: DEFAULT_ENCHANT_VALUE
|
||||
}
|
||||
|
||||
fun getEnchantKey(enchantment: Enchantment) : String{
|
||||
val enchantKey = enchantment.enchantmentName
|
||||
if(enchantKey == "sweeping_edge"){ // compatibility with 1.20.5. TODO better update system
|
||||
return "sweeping"
|
||||
}
|
||||
return enchantKey
|
||||
}
|
||||
/**
|
||||
* Get an array of key of basic config options
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue