From a4c42054306a5c5ec6e3daeb2ff98e9c816b0b9a Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Mon, 8 Jan 2024 10:57:56 -0500 Subject: option to hide pet candy count on max + fix pet lvl regex (#857) Added option to hide pet candy count on maxed out pets. #857 --- .../skyhanni/features/misc/PetCandyUsedDisplay.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt index 87def5df3..886827e23 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt @@ -1,19 +1,28 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMaxPetLevel import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetCandyUsed +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PetCandyUsedDisplay { + private val config get() = SkyHanniMod.feature.misc.petCandy + @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { val stack = event.stack ?: return if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return - if (!SkyHanniMod.feature.misc.petCandyUsed) return + if (!config.showCandy) return + + if (config.hideOnMaxed) { + if (stack.getPetLevel() == stack.getMaxPetLevel()) return + } val petCandyUsed = stack.getPetCandyUsed() ?: return if (petCandyUsed == 0) return @@ -24,4 +33,9 @@ class PetCandyUsedDisplay { event.drawSlotText(x, y, stackTip, .9f) } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(22, "misc.petCandyUsed", "misc.petCandy.showCandy") + } } -- cgit