diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-21 16:12:57 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-21 16:12:57 +0200 |
commit | c9eb62dedbec7a5a9f626ba778b14c951fac383e (patch) | |
tree | 0c3df4d8d9242e14dd77e3c7b4ae6858b1a9c530 /src/main/java/at/hannibal2/skyhanni/features | |
parent | 68c6bd4834cca0fe224074209ac90f04454e4850 (diff) | |
download | skyhanni-c9eb62dedbec7a5a9f626ba778b14c951fac383e.tar.gz skyhanni-c9eb62dedbec7a5a9f626ba778b14c951fac383e.tar.bz2 skyhanni-c9eb62dedbec7a5a9f626ba778b14c951fac383e.zip |
more makeAccessible usage
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index 5c7871a1e..2f21ebe03 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.test.command.CopyErrorCommand import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.jsonobjects.ModsJson import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -85,12 +86,12 @@ object QuickModMenuSwitch { private fun handleAbstractGuis(openGui: String): String { if (openGui == "gg.essential.vigilance.gui.SettingsGui") { val clazz = Class.forName("gg.essential.vigilance.gui.SettingsGui") - val titleBarDelegate = clazz.getDeclaredField("titleBar\$delegate").also { it.isAccessible = true } + val titleBarDelegate = clazz.getDeclaredField("titleBar\$delegate").makeAccessible() .get(Minecraft.getMinecraft().currentScreen) val titleBar = - titleBarDelegate.javaClass.declaredFields[0].also { it.isAccessible = true }.get(titleBarDelegate) - val gui = titleBar.javaClass.getDeclaredField("gui").also { it.isAccessible = true }.get(titleBar) - val config = gui.javaClass.getDeclaredField("config").also { it.isAccessible = true }.get(gui) + titleBarDelegate.javaClass.declaredFields[0].makeAccessible().get(titleBarDelegate) + val gui = titleBar.javaClass.getDeclaredField("gui").makeAccessible().get(titleBar) + val config = gui.javaClass.getDeclaredField("config").makeAccessible().get(gui) return config.javaClass.name } |