diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-20 00:56:40 +0100 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-20 00:56:40 +0100 |
| commit | 8964cf9bd7647fd9216ce0c3e5af229dabfa5fb5 (patch) | |
| tree | bf15062d5b293938cb9c25af0164589f67b8ca39 /src/main/java/at/hannibal2/skyhanni/utils | |
| parent | 86e9f31988715756c0fce31963a162b90ed0e2b6 (diff) | |
| download | skyhanni-8964cf9bd7647fd9216ce0c3e5af229dabfa5fb5.tar.gz skyhanni-8964cf9bd7647fd9216ce0c3e5af229dabfa5fb5.tar.bz2 skyhanni-8964cf9bd7647fd9216ce0c3e5af229dabfa5fb5.zip | |
Fixed ender chest not reopening correctly after opening gui editor.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt index eb06c23ee..2a6b002af 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/InventoryUtils.kt @@ -1,14 +1,12 @@ package at.hannibal2.skyhanni.utils -import at.hannibal2.skyhanni.config.ConfigManager -import at.hannibal2.skyhanni.data.OtherMod import at.hannibal2.skyhanni.test.command.ErrorManager +import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraft.client.Minecraft import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest import net.minecraft.inventory.Slot import net.minecraft.item.ItemStack -import java.io.File import kotlin.time.Duration.Companion.seconds object InventoryUtils { @@ -56,15 +54,14 @@ object InventoryUtils { val isNeuStorageEnabled = RecalculatingValue(10.seconds) { try { - 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) { + val config = NotEnoughUpdates.INSTANCE.config + + val storageField = config.javaClass.getDeclaredField("storageGUI") + val storage = storageField.get(config) + + val booleanField = storage.javaClass.getDeclaredField("enableStorageGUI3") + booleanField.get(storage) as Boolean + } catch (e: Throwable) { ErrorManager.logError(e, "Could not read NEU config to determine if the neu storage is emabled.") false } |
