aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-08 13:28:44 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-08 13:28:44 +0100
commit247656e0d4cd1733028009cecfab98c26953b795 (patch)
tree913c565b419d9c6998b94b092a27f3ab22fa0ead
parent22f6efe16fb49db123d10cf0117a85feea197ce1 (diff)
downloadskyhanni-247656e0d4cd1733028009cecfab98c26953b795.tar.gz
skyhanni-247656e0d4cd1733028009cecfab98c26953b795.tar.bz2
skyhanni-247656e0d4cd1733028009cecfab98c26953b795.zip
Added an abstract error message on LorenzToolTipEvent error.
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
index 97c4e455a..3b8f6b7a7 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ToolTipData.kt
@@ -1,6 +1,10 @@
package at.hannibal2.skyhanni.data
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
+import at.hannibal2.skyhanni.test.command.ErrorManager
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.ItemUtils.getLore
+import at.hannibal2.skyhanni.utils.ItemUtils.name
import net.minecraft.inventory.Slot
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
@@ -13,7 +17,22 @@ class ToolTipData {
fun onTooltip(event: ItemTooltipEvent) {
val toolTip = event.toolTip ?: return
val slot = lastSlot ?: return
- LorenzToolTipEvent(slot, event.itemStack, toolTip).postAndCatch()
+ val itemStack = event.itemStack ?: return
+ try {
+ LorenzToolTipEvent(slot, itemStack, toolTip).postAndCatch()
+ } catch (e: Throwable) {
+ ErrorManager.logErrorWithData(
+ e, "Error in item tool tip parsing or rendering detected",
+ "toolTip" to toolTip,
+ "slot" to slot,
+ "slotNumber" to slot.slotNumber,
+ "slotIndex" to slot.slotIndex,
+ "itemStack" to itemStack,
+ "name" to itemStack.name,
+ "internal name" to itemStack.getInternalName(),
+ "lore" to itemStack.getLore(),
+ )
+ }
}
companion object {