diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-15 16:47:24 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-15 16:47:24 +0100 |
commit | b191e8404c877e56ebbf3aba17916ceb195af8a6 (patch) | |
tree | f5118929e769cd3e738aa8d38d8adad73e6ef90b /src/main/java/at/hannibal2/skyhanni | |
parent | ecdd0502e7aef26b1fba17f763d769b25c1a34d4 (diff) | |
download | skyhanni-b191e8404c877e56ebbf3aba17916ceb195af8a6.tar.gz skyhanni-b191e8404c877e56ebbf3aba17916ceb195af8a6.tar.bz2 skyhanni-b191e8404c877e56ebbf3aba17916ceb195af8a6.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt | 39 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt | 3 |
2 files changed, 20 insertions, 22 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index 6150d60fc..2992d901c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.drawSlotText import at.hannibal2.skyhanni.utils.RenderUtils.highlight +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -116,31 +117,29 @@ class JacobFarmingContestsInventory { if (!InventoryUtils.openInventoryName().contains("Your Contests")) return val stack = event.stack ?: return - var finneganContest = false for (line in stack.getLore()) { - if (line.contains("Contest boosted by Finnegan!")) finneganContest = true - - val matcher = contestEarnedPattern.matcher(line) - if (matcher.matches()) { - val medalEarned = ContestBracket.entries.find { it.color == matcher.group("medalColour") } ?: return - - var stackTip = "§${medalEarned.color}✦" - var x = event.x + 9 - var y = event.y + 1 - var scale = .7f - - if (finneganContest && config.finneganIcon) { - stackTip = "§${medalEarned.color}▲" - x = event.x + 5 - y = event.y - 2 - scale = 1.3f - } + val finneganContest = line.contains("Contest boosted by Finnegan!") + + val color = contestEarnedPattern.matchMatcher(line) { group("medalColour") } ?: continue + val medalEarned = ContestBracket.entries.find { it.color == color } ?: return + + var stackTip = "§${medalEarned.color}✦" + var x = event.x + 9 + var y = event.y + 1 + var scale = .7f - event.drawSlotText(x, y, stackTip, scale) + if (finneganContest && config.finneganIcon) { + stackTip = "§${medalEarned.color}▲" + x = event.x + 5 + y = event.y - 2 + scale = 1.3f } + + event.drawSlotText(x, y, stackTip, scale) } } + @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.move(3, "inventory.jacobFarmingContestHighlightRewards", "inventory.jacobFarmingContests.highlightRewards") @@ -149,4 +148,4 @@ class JacobFarmingContestsInventory { event.move(3, "inventory.jacobFarmingContestFinneganIcon", "inventory.jacobFarmingContests.finneganIcon") event.move(3, "inventory.jacobFarmingContestMedalIcon", "inventory.jacobFarmingContests.medalIcon") } -}
\ No newline at end of file +} 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 351e3123d..87def5df3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt @@ -15,7 +15,6 @@ class PetCandyUsedDisplay { if (!LorenzUtils.inSkyBlock || stack.stackSize != 1) return if (!SkyHanniMod.feature.misc.petCandyUsed) return - val petCandyUsed = stack.getPetCandyUsed() ?: return if (petCandyUsed == 0) return @@ -25,4 +24,4 @@ class PetCandyUsedDisplay { event.drawSlotText(x, y, stackTip, .9f) } -}
\ No newline at end of file +} |