diff options
| author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-05-16 19:19:38 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-16 11:19:38 +0200 |
| commit | 4140b88a2a0b045169f90f392292528aca626d8a (patch) | |
| tree | bd3bcdb3ab8ab7813cfe17c806e90bdcedf4efb0 /src/main/java/at/hannibal2/skyhanni/features/misc | |
| parent | d4f7a7753d7ba772add76b43bcf2f692d10f25ad (diff) | |
| download | skyhanni-4140b88a2a0b045169f90f392292528aca626d8a.tar.gz skyhanni-4140b88a2a0b045169f90f392292528aca626d8a.tar.bz2 skyhanni-4140b88a2a0b045169f90f392292528aca626d8a.zip | |
Fix white enchantments (#1798)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt | 17 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt | 5 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt index a44be9824..d010198dd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/Enchant.kt @@ -1,6 +1,8 @@ package at.hannibal2.skyhanni.features.misc.items.enchants import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.features.chroma.ChromaManager +import at.hannibal2.skyhanni.utils.LorenzColor import com.google.gson.annotations.Expose import java.util.TreeSet @@ -25,11 +27,18 @@ open class Enchant : Comparable<Enchant> { open fun getFormat(level: Int): String { val config = SkyHanniMod.feature.inventory.enchantParsing + // TODO change color to string (support for bold) - if (level >= maxLevel) return config.perfectEnchantColor.get().getChatColor() - if (level > goodLevel) return config.greatEnchantColor.get().getChatColor() - if (level == goodLevel) return config.goodEnchantColor.get().getChatColor() - return config.poorEnchantColor.get().getChatColor() + val colour = when { + level >= maxLevel -> config.perfectEnchantColor + level > goodLevel -> config.greatEnchantColor + level == goodLevel -> config.goodEnchantColor + else -> config.poorEnchantColor + } + + // TODO when chroma is disabled maybe use the neu chroma style instead of gold + if (colour.get() == LorenzColor.CHROMA && !(ChromaManager.config.enabled.get() || EnchantParser.isSbaLoaded)) return "§6§l" + return colour.get().getChatColor() } override fun toString() = "$nbtName $goodLevel $maxLevel\n" diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt index 593e844d4..5c8f9b893 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.ChatHoverEvent import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.features.chroma.ChromaManager import at.hannibal2.skyhanni.mixins.hooks.GuiChatHook import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ConditionalUtils @@ -22,6 +23,7 @@ import net.minecraft.event.HoverEvent import net.minecraft.item.ItemStack import net.minecraft.util.ChatComponentText import net.minecraft.util.IChatComponent +import net.minecraftforge.fml.common.Loader import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.TreeSet @@ -58,6 +60,8 @@ object EnchantParser { private val loreCache: Cache = Cache() + val isSbaLoaded by lazy { Loader.isModLoaded("skyblockaddons") } + // Maps for all enchants private var enchants: EnchantsJson = EnchantsJson() @@ -79,6 +83,7 @@ object EnchantParser { config.commaFormat, config.hideVanillaEnchants, config.hideEnchantDescriptions, + ChromaManager.config.enabled, ) { markCacheDirty() } |
