diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-06 02:14:41 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-06 02:14:41 +0100 |
commit | 51420aa83028ae57d15006750a60c2265825acd3 (patch) | |
tree | 9bdccc2b5b2e2fc495dbcd106cd0ff36014f3cb2 /src/main/java/at/hannibal2/skyhanni | |
parent | 4d4180cdc4b05abcff46f780da8b057d0e23c287 (diff) | |
download | skyhanni-51420aa83028ae57d15006750a60c2265825acd3.tar.gz skyhanni-51420aa83028ae57d15006750a60c2265825acd3.tar.bz2 skyhanni-51420aa83028ae57d15006750a60c2265825acd3.zip |
added support to allow editing in bingo card view
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt index 2d231f5c6..126212ba6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt @@ -167,20 +167,20 @@ class BingoCardDisplay { } private fun MutableList<Renderable>.addGoals(goals: MutableList<BingoGoal>, format: (BingoGoal) -> String) { - val currentlyOpen = Minecraft.getMinecraft().currentScreen is GuiInventory + val editDisplay = canEditDisplay() val showOnlyHighlighted = goals.count { it.highlight } > 0 - val filter = showOnlyHighlighted && !currentlyOpen + val filter = showOnlyHighlighted && !editDisplay val finalGoal = if (filter) { goals.filter { it.highlight } } else goals finalGoal.mapTo(this) { val currentlyHighlighted = it.highlight - val highlightColor = if (currentlyHighlighted && currentlyOpen) "§e" else "§7" + val highlightColor = if (currentlyHighlighted && editDisplay) "§e" else "§7" val display = " $highlightColor" + format(it) - if (currentlyOpen) { + if (editDisplay) { val clickName = if (currentlyHighlighted) "remove" else "add" Renderable.clickAndHover( display, @@ -223,7 +223,7 @@ class BingoCardDisplay { if (!LorenzUtils.isBingoProfile) return if (!config.enabled) return - val currentlyOpen = Minecraft.getMinecraft().currentScreen is GuiInventory + val currentlyOpen = canEditDisplay() if (inventoryOpen != currentlyOpen) { inventoryOpen = currentlyOpen update() @@ -250,6 +250,9 @@ class BingoCardDisplay { } } + private fun canEditDisplay() = + Minecraft.getMinecraft().currentScreen is GuiInventory || InventoryUtils.openInventoryName() == "Bingo Card" + @SubscribeEvent fun onBingoCardUpdate(event: BingoCardUpdateEvent) { if (!config.enabled) return |