diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-05-06 18:47:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 18:47:24 +0200 |
commit | 87d192e8933281bb39f425b9f373c47b23a0e110 (patch) | |
tree | 1fa259be0e205a0b36555473efd8815d9b5e1466 /src/main/java/at/hannibal2/skyhanni/features | |
parent | 8043115be517f8294c81d71594461e003f1adf80 (diff) | |
download | skyhanni-87d192e8933281bb39f425b9f373c47b23a0e110.tar.gz skyhanni-87d192e8933281bb39f425b9f373c47b23a0e110.tar.bz2 skyhanni-87d192e8933281bb39f425b9f373c47b23a0e110.zip |
Improvement: Open rng inv via the Display (#1694)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt | 19 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt | 14 |
2 files changed, 20 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index 180bd0a69..93d1a414d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.itemName @@ -21,11 +22,12 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatLong -import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.StringUtils.removeWordsAtEnd +import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.ceil @@ -53,7 +55,7 @@ class SlayerRngMeterDisplay { "§aYou set your §r.* RNG Meter §r§ato drop §r.*§a!" ) - private var display = "" + private var display = emptyList<Renderable>() private var lastItemDroppedTime = 0L var rngScore = mapOf<String, Map<NEUInternalName, Long>>() @@ -186,10 +188,15 @@ class SlayerRngMeterDisplay { } private fun update() { - display = drawDisplay() + display = listOf(makeLink(drawDisplay())) } - private fun drawDisplay(): String { + private fun makeLink(text: String) = + Renderable.clickAndHover(text, listOf("§eClick to open RNG Meter Inventory."), onClick = { + HypixelCommands.showRng("slayer", SlayerAPI.getActiveSlayer()?.rngName) + }) + + fun drawDisplay(): String { val storage = getStorage() ?: return "" if (SlayerAPI.latestSlayerCategory.let { @@ -221,12 +228,12 @@ class SlayerRngMeterDisplay { } @SubscribeEvent - fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + fun onRenderOverlay(event: GuiRenderEvent) { if (!isEnabled()) return if (!SlayerAPI.isInCorrectArea) return if (!SlayerAPI.hasActiveSlayerQuest()) return - config.pos.renderString(display, posLabel = "RNG Meter Display") + config.pos.renderRenderables(display, posLabel = "RNG Meter Display") } fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt index 6d692e5da..c7a1f2fde 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerType.kt @@ -6,12 +6,12 @@ import net.minecraft.entity.monster.EntitySpider import net.minecraft.entity.monster.EntityZombie import net.minecraft.entity.passive.EntityWolf -enum class SlayerType(val displayName: String, val clazz: Class<*>) { - REVENANT("Revenant Horror", EntityZombie::class.java), - TARANTULA("Tarantula Broodfather", EntitySpider::class.java), - SVEN("Sven Packmaster", EntityWolf::class.java), - VOID("Voidgloom Seraph", EntityEnderman::class.java), - INFERNO("Inferno Demonlord", EntityBlaze::class.java), - VAMPIRE("Riftstalker Bloodfiend", EntityZombie::class.java) +enum class SlayerType(val displayName: String, val rngName: String, val clazz: Class<*>) { + REVENANT("Revenant Horror", "revenant", EntityZombie::class.java), + TARANTULA("Tarantula Broodfather", "tarantula", EntitySpider::class.java), + SVEN("Sven Packmaster", "sven", EntityWolf::class.java), + VOID("Voidgloom Seraph", "voidgloom", EntityEnderman::class.java), + INFERNO("Inferno Demonlord", "inferno", EntityBlaze::class.java), + VAMPIRE("Riftstalker Bloodfiend", "vampire", EntityZombie::class.java) ; } |