From 51420aa83028ae57d15006750a60c2265825acd3 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 6 Dec 2023 02:14:41 +0100 Subject: added support to allow editing in bingo card view --- .../skyhanni/features/bingo/card/BingoCardDisplay.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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.addGoals(goals: MutableList, 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 -- cgit