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:
alexcrea 2024-04-28 03:20:32 +02:00
parent 2861238f58
commit 46ff34deea
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
7 changed files with 43 additions and 11 deletions

View file

@ -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
*/