diff options
Diffstat (limited to 'src/main')
4 files changed, 22 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt index b31a7f574..7ff1949ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.utils.InventoryUtils -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NumberUtil @@ -53,7 +53,7 @@ class EstimatedWardrobePrice { val map = mutableMapOf<Int, MutableList<ItemStack>>() for ((slot, item) in event.inventoryItems) { - if (item.getInternalName() == "") continue + item.getInternalNameOrNull() ?: continue val price = EstimatedItemValue.getEstimatedItemPrice(item, mutableListOf()).first if (price == 0.0) continue val id = slot % 9 diff --git a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt index 63b552373..ea814420c 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/HighlightMissingRepoItems.kt @@ -2,9 +2,11 @@ package at.hannibal2.skyhanni.test import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiContainerEvent -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.MultiFilter import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraft.client.Minecraft @@ -15,6 +17,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class HighlightMissingRepoItems { + private val ignoreItems = MultiFilter() @SubscribeEvent(priority = EventPriority.LOWEST) fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) { @@ -34,17 +37,23 @@ class HighlightMissingRepoItems { private fun highlightItems(slots: Iterable<Slot>) { if (NEUItems.allInternalNames.isEmpty()) return for (slot in slots) { - if (!slot.hasStack) continue - val internalName = slot.stack.getInternalName() - if (internalName == "") continue - if (!NEUItems.allInternalNames.contains(internalName)) { - slot highlight LorenzColor.RED - } + val internalName = slot.stack?.getInternalNameOrNull() ?: continue + if (NEUItems.allInternalNames.contains(internalName)) continue + if (ignoreItems.match(internalName)) continue + + slot highlight LorenzColor.RED } } @SubscribeEvent - fun onRepoReload(event: io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent) { + fun onNeuRepoReload(event: io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent) { NEUItems.allItemsCache = NEUItems.readAllNeuItems() } + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + event.getConstant("IgnoredItems")?.let { + ignoreItems.load(it.asJsonObject) + } + } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index e9adfe055..9b06dfb8d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -115,6 +115,8 @@ object ItemUtils { return false } + fun ItemStack.getInternalNameOrNull() = getInternalName().takeIf { it != "" } + fun ItemStack.getInternalName(): String { if (name == "§fWisp's Ice-Flavored Water I Splash Potion") { return "WISP_POTION" diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt index 947019aa6..c8ecc2055 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MultiFilter.kt @@ -18,6 +18,7 @@ class MultiFilter { containsWord.clear() fill(hideNpcSell, "equals", equals) + fill(hideNpcSell, "exact", equals) fill(hideNpcSell, "startsWith", startsWith) fill(hideNpcSell, "endsWith", endsWith) fill(hideNpcSell, "contains", contains) |