From 46a024129e4c47137956c6e7f022c0914a92a3f1 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 2 Apr 2023 18:25:40 +0200 Subject: Opening crafted generators inventory will detect minions for bingo craft minion helper --- .../skyhanni/features/bingo/MinionCraftHelper.kt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index 88d69a672..fca965c15 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.SendTitleHelper import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -21,7 +22,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent import java.util.regex.Pattern class MinionCraftHelper { - private var minionNamePattern = Pattern.compile("(.*) Minion (.*)") private var tick = 0 private var display = listOf() @@ -267,4 +267,20 @@ class MinionCraftHelper { } private fun isMinionName(itemName: String) = itemName.contains(" Minion ") && !itemName.contains(" Minion Skin") + + @SubscribeEvent + fun onInventoryOpen(event: InventoryOpenEvent) { + if (!LorenzUtils.isBingoProfile) return + if (event.inventoryName != "Crafted Minions") return + + for ((_, b) in event.inventoryItems) { + val name = b.name?: continue + if (!name.startsWith("§e")) continue + + val internalName = NEUItems.getInternalName("$name I") + if (!tierOneMinionsDone.contains(internalName)) { + tierOneMinionsDone.add(internalName) + } + } + } } -- cgit