diff --git a/settings.gradle b/settings.gradle index ff436f2..9f80246 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43' } diff --git a/src/main/java/lumien/custommainmenu/lib/actions/ActionOpenGUI.java b/src/main/java/lumien/custommainmenu/lib/actions/ActionOpenGUI.java index 0f469e8..075829f 100644 --- a/src/main/java/lumien/custommainmenu/lib/actions/ActionOpenGUI.java +++ b/src/main/java/lumien/custommainmenu/lib/actions/ActionOpenGUI.java @@ -1,5 +1,8 @@ package lumien.custommainmenu.lib.actions; +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiControls; import net.minecraft.client.gui.GuiCreateWorld; @@ -19,6 +22,7 @@ import net.minecraft.client.stream.IStream; import cpw.mods.fml.client.GuiModList; +import cpw.mods.fml.common.Loader; import lumien.custommainmenu.CustomMainMenu; import lumien.custommainmenu.gui.GuiCustom; @@ -50,6 +54,30 @@ public void perform(Object source, GuiCustom menu) { gui = new GuiLanguage(menu, menu.mc.gameSettings, menu.mc.getLanguageManager()); } else if (this.guiName.equalsIgnoreCase("options.ressourcepacks")) { gui = new GuiScreenResourcePacks(menu); + } else if (this.guiName.equalsIgnoreCase("options.resourcepacks")) { + gui = new GuiScreenResourcePacks(menu); + } else if (this.guiName.equalsIgnoreCase("options.shaderpacks")) { + if (Loader.isModLoaded("angelica")) { + try { + Class guiShadersClass = Class.forName("net.coderbot.iris.gui.screen.ShaderPackScreen"); + Constructor constructor = guiShadersClass.getConstructor(GuiScreen.class); + Object guiInstance = constructor.newInstance(menu.mc.currentScreen); + gui = (GuiScreen) guiInstance; + } catch (Exception e) { + throw new RuntimeException(e); + } + } else if (Loader.isModLoaded("swansong")) { + try { + Class guiShadersClass = Class.forName("com.ventooth.swansong.gui.GuiShaders"); + Constructor constructor = guiShadersClass.getConstructor(GuiScreen.class); + Object guiInstance = constructor.newInstance(menu.mc.currentScreen); + gui = (GuiScreen) guiInstance; + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + gui = new GuiScreenResourcePacks(menu); + } } else if (this.guiName.equalsIgnoreCase("options.snooper")) { gui = new GuiSnooper(menu, menu.mc.gameSettings); } else if (this.guiName.equalsIgnoreCase("options.sounds")) { @@ -63,7 +91,41 @@ public void perform(Object source, GuiCustom menu) { GuiStreamUnavailable.func_152321_a(menu); } } else if (this.guiName.equalsIgnoreCase("options.video")) { - gui = new GuiVideoSettings(menu, menu.mc.gameSettings); + if (Loader.isModLoaded("angelica")) { + try { + Class guiShadersClass = Class.forName("me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI"); + Constructor constructor = guiShadersClass.getConstructor(GuiScreen.class); + Object guiInstance = constructor.newInstance(menu.mc.currentScreen); + gui = (GuiScreen) guiInstance; + } catch (Exception e) { + throw new RuntimeException(e); + } + } else if (Loader.isModLoaded("notfine")) { + try { + final String OPTION_PAGE_FQN = "me.jellysquid.mods.sodium.client.gui.options.OptionPage"; + Class optionPageClass = Class.forName(OPTION_PAGE_FQN); + Class notFineOptionsClass = Class.forName("jss.notfine.gui.NotFineGameOptionPages"); + Object generalPage = notFineOptionsClass.getMethod("general").invoke(null); + Object detailPage = notFineOptionsClass.getMethod("detail").invoke(null); + Object atmospherePage = notFineOptionsClass.getMethod("atmosphere").invoke(null); + Object particlesPage = notFineOptionsClass.getMethod("particles").invoke(null); + Object otherPage = notFineOptionsClass.getMethod("other").invoke(null); + Object[] subPages = (Object[]) Array.newInstance(optionPageClass, 4); + subPages[0] = detailPage; + subPages[1] = atmospherePage; + subPages[2] = particlesPage; + subPages[3] = otherPage; + Class optionPageArrayClass = Class.forName("[L" + OPTION_PAGE_FQN + ";"); + Constructor constructor = Class.forName("jss.notfine.gui.GuiCustomMenu") + .getConstructor(GuiScreen.class, optionPageClass, optionPageArrayClass); + Object guiInstance = constructor.newInstance(menu.mc.currentScreen, generalPage, subPages); + gui = (GuiScreen) guiInstance; + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + gui = new GuiVideoSettings(menu, menu.mc.gameSettings); + } } else if (this.guiName.equalsIgnoreCase("options.controls")) { gui = new GuiControls(menu, menu.mc.gameSettings); } else if (this.guiName.equalsIgnoreCase("options.multiplayer")) {