diff options
author | Erymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> | 2023-10-14 09:31:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-14 15:31:51 +0200 |
commit | 6f1fe665fc78757cc74ca7461c1700eaddec9f52 (patch) | |
tree | fb59ce633aed1a90c571ecc6504136f287a770c2 /src/main | |
parent | 8152a3985c9b2f883030a1f8ee79a6f69570da76 (diff) | |
download | skyhanni-6f1fe665fc78757cc74ca7461c1700eaddec9f52.tar.gz skyhanni-6f1fe665fc78757cc74ca7461c1700eaddec9f52.tar.bz2 skyhanni-6f1fe665fc78757cc74ca7461c1700eaddec9f52.zip |
bring back former storagegui code but in trycatch (#568)
old check for neu storage enabled #568
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt | 17 |
1 files changed, 13 insertions, 4 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 6324c6350..9e627e897 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChestValue.kt @@ -1,13 +1,16 @@ 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 @@ -31,6 +34,7 @@ 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 { @@ -246,10 +250,15 @@ class ChestValue { private val isNeuStorageEnabled = RecalculatingValue(1.seconds) { try { - NotEnoughUpdates.INSTANCE.config.storageGUI.enableStorageGUI3 - } catch (e: Exception) { - false - } + 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 + } catch (e: Exception) { false } } private fun String.reduceStringLength(targetLength: Int, char: Char): String { |