diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-12 10:38:57 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-12 10:38:57 +0200 |
commit | ec19d756630c0477f0f6ff0fbbdff9a44be10fdd (patch) | |
tree | 063ae0fdfa1c169d9bac8cbae185fb024d36560e /src/main/java/at/hannibal2/skyhanni/features | |
parent | c1f6d3e50dfc6365906822df51326881d6b2f577 (diff) | |
download | skyhanni-ec19d756630c0477f0f6ff0fbbdff9a44be10fdd.tar.gz skyhanni-ec19d756630c0477f0f6ff0fbbdff9a44be10fdd.tar.bz2 skyhanni-ec19d756630c0477f0f6ff0fbbdff9a44be10fdd.zip |
Fixed rare crash when trying to read neu config.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt index 70c6e8025..6324c6350 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt @@ -1,16 +1,13 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.OtherMod import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryOpenEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValue -import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.LorenzUtils @@ -26,6 +23,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SpecialColour import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable +import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.init.Items @@ -33,7 +31,6 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.awt.Color -import java.io.File import kotlin.time.Duration.Companion.seconds class ChestValue { @@ -248,17 +245,13 @@ class ChestValue { } private val isNeuStorageEnabled = RecalculatingValue(1.seconds) { - val configPath = OtherMod.NEU.configPath - if (File(configPath).exists()) { - val json = ConfigManager.gson.fromJson( - APIUtil.readFile(File(configPath)), - com.google.gson.JsonObject::class.java - ) - json["storageGUI"].asJsonObject["enableStorageGUI3"].asBoolean - } else false + try { + NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 + } catch (e: Exception) { + false + } } - private fun String.reduceStringLength(targetLength: Int, char: Char): String { val mc = Minecraft.getMinecraft() val spaceWidth = mc.fontRendererObj.getCharWidth(char) |