From b3b9f855f665158b8646095c011f1ae85e05c09a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:58:20 +0100 Subject: workaround for crash --- .../at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt index 0bf44d0a0..35220e27b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenPlotAPI import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isBarn import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.name +import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.gui.FontRenderer @@ -25,6 +26,18 @@ fun drawString( * @return The replaced line, or null if it should be hidden */ fun tryToReplaceScoreboardLine(text: String): String? { + try { + return tryToReplaceScoreboardLineHarder(text) + } catch (t: Throwable) { + ErrorManager.logErrorWithData( + t, "Error while changing the scoreboard text.", + "text" to text + ) + return text + } +} + +private fun tryToReplaceScoreboardLineHarder(text: String): String? { if (SkyHanniMod.feature.misc.hideScoreboardNumbers && text.startsWith("§c") && text.length <= 4) { return null } -- cgit