aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-02 18:25:40 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-02 18:25:40 +0200
commit46a024129e4c47137956c6e7f022c0914a92a3f1 (patch)
tree5420eb2988ccdfe70f7fb6fa2d4db475f8b17eb6
parent6ee6ce3a16aa2f02fb14c322535ad216adedc472 (diff)
downloadskyhanni-46a024129e4c47137956c6e7f022c0914a92a3f1.tar.gz
skyhanni-46a024129e4c47137956c6e7f022c0914a92a3f1.tar.bz2
skyhanni-46a024129e4c47137956c6e7f022c0914a92a3f1.zip
Opening crafted generators inventory will detect minions for bingo craft minion helper
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt18
1 files changed, 17 insertions, 1 deletions
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<String>()
@@ -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)
+ }
+ }
+ }
}