From 8c54be95700b224c2f93b549465dbe06bf3bbe86 Mon Sep 17 00:00:00 2001 From: Fazfoxy <78978526+Fazfoxy@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:49:06 +0100 Subject: Fix: buy from bazaar supercraft on overflowed inventory names (#2703) Co-authored-by: Cal --- .../features/inventory/bazaar/CraftMaterialsFromBazaar.kt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt index b5c3c6ab4..36b5fa505 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt @@ -17,10 +17,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.PrimitiveItemStack import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack -import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.renderables.Renderable -import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -29,10 +27,6 @@ object CraftMaterialsFromBazaar { private val config get() = SkyHanniMod.feature.inventory.bazaar private val materialSlots = listOf(10, 11, 12, 19, 20, 21, 28, 29, 30) - private val inventoryPattern by RepoPattern.pattern( - "inventory.recipe.title", - ".* Recipe" - ) private var inRecipeInventory = false private var purchasing = false @@ -43,11 +37,11 @@ object CraftMaterialsFromBazaar { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!isEnabled()) return - val correctInventoryName = inventoryPattern.matches(event.inventoryName) val items = event.inventoryItems val correctItem = items[23]?.name == "§aCrafting Table" + val correctSuperCraftItem = items[32]?.name == "§aSupercraft" - inRecipeInventory = correctInventoryName && correctItem && !purchasing + inRecipeInventory = correctSuperCraftItem && correctItem && !purchasing if (!inRecipeInventory) return val recipeName = items[25]?.itemName ?: return -- cgit