Skip to content

Commit

Permalink
Fix: buy from bazaar supercraft on overflowed inventory names (#2703)
Browse files Browse the repository at this point in the history
Co-authored-by: Cal <cwolfson58@gmail.com>
  • Loading branch information
Fazfoxy and CalMWolfs authored Oct 11, 2024
1 parent ec5c195 commit 8c54be9
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8c54be9

Please sign in to comment.