From b7aa6cddd2a4134ff3ee53c8c1bc707dc1cab89c Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 15 Feb 2024 20:42:19 +0100 Subject: Add bazaar order support --- src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt | 5 ++++- src/main/kotlin/moe/nea/ledger/Ledger.kt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/moe') diff --git a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt index 988e317..b1d953e 100644 --- a/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt +++ b/src/main/kotlin/moe/nea/ledger/ItemIdProvider.kt @@ -25,11 +25,14 @@ class ItemIdProvider { fun saveInventoryIds(event: BeforeGuiAction) { val chest = (event.gui as? GuiChest) ?: return val slots = chest.inventorySlots as ContainerChest + val isOrderMenu = slots.lowerChestInventory.name.unformattedString() == "Your Bazaar Orders" slots.inventorySlots.forEach { val stack = it.stack ?: return@forEach val nbt = stack.tagCompound ?: NBTTagCompound() val display = nbt.getCompoundTag("display") - val name = display.getString("Name").unformattedString() + var name = display.getString("Name").unformattedString() + if (isOrderMenu) + name = name.removePrefix("BUY ").removePrefix("SELL ") val id = stack.getInternalId() if (id != null && name.isNotBlank()) { knownNames[name] = id diff --git a/src/main/kotlin/moe/nea/ledger/Ledger.kt b/src/main/kotlin/moe/nea/ledger/Ledger.kt index d1fc57d..e9f5efc 100644 --- a/src/main/kotlin/moe/nea/ledger/Ledger.kt +++ b/src/main/kotlin/moe/nea/ledger/Ledger.kt @@ -43,6 +43,7 @@ class Ledger { ids, BankDetection(ledger), BazaarDetection(ledger, ids), + BazaarOrderDetection(ledger, ids), AuctionHouseDetection(ledger, ids), ).forEach(MinecraftForge.EVENT_BUS::register) } -- cgit