diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-09 12:47:14 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-09 12:47:14 +0100 |
commit | 1c1c69f088036eb2e9f265c7e0c7fbcfb5d123b8 (patch) | |
tree | 1d23ba6e6a0a7c51dd448542b9af0b7a0af0e472 /src/main/java/at/hannibal2 | |
parent | aff4c2a100b4fcfbfcaac625728f55fe68dc6872 (diff) | |
download | skyhanni-1c1c69f088036eb2e9f265c7e0c7fbcfb5d123b8.tar.gz skyhanni-1c1c69f088036eb2e9f265c7e0c7fbcfb5d123b8.tar.bz2 skyhanni-1c1c69f088036eb2e9f265c7e0c7fbcfb5d123b8.zip |
Fixed error messages in composter inventory when hovering over some items.
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 5 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt index 538087fac..9e18fced9 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzToolTipEvent.kt @@ -3,4 +3,6 @@ package at.hannibal2.skyhanni.events import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack -class LorenzToolTipEvent(val slot: Slot, val itemStack: ItemStack, var toolTip: MutableList<String>) : LorenzEvent()
\ No newline at end of file +class LorenzToolTipEvent(val slot: Slot, val itemStack: ItemStack, var toolTip: MutableList<String>) : LorenzEvent() { + fun toolTipRemovedPrefix() = toolTip.map { it.removePrefix("§5§o") } +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index 75e62468f..e57789884 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.LorenzToolTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI -import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getLore @@ -34,18 +33,8 @@ class GardenComposterInventoryFeatures { var indexFullCost = 0 var fullPrice = 0.0 var amountItems = 0 - for (originalLine in list) { + for (line in event.toolTipRemovedPrefix()) { i++ - val line = try { - originalLine.substring(4) - } catch (e: Throwable) { - ErrorManager.logErrorWithData( - e, "Error reading composter data.", - "originalLine" to originalLine, - "list" to list, - ) - return - } if (line == "§7Upgrade Cost:") { next = true indexFullCost = i diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt index 9a4deaf2f..037031360 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt @@ -25,9 +25,8 @@ class GardenNextPlotPrice { var next = false val list = event.toolTip var i = -1 - for (l in list) { + for (line in event.toolTipRemovedPrefix()) { i++ - val line = l.substring(4) if (line.contains("Cost")) { next = true continue |