And now we no longer override GuiMainMenu. Hackery rocks!

This commit is contained in:
Adubbz 2014-01-14 23:03:43 +11:00
parent f0c0a8070d
commit 41642969ae
3 changed files with 18 additions and 33 deletions

View file

@ -4,7 +4,7 @@ import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.common.eventhandler.entity.DyeEventHandler;
import biomesoplenty.common.eventhandler.entity.FlippersEventHandler;
import biomesoplenty.common.eventhandler.entity.TemptEventHandler;
import biomesoplenty.common.eventhandler.gui.MainMenuOverrideEventHandler;
import biomesoplenty.common.eventhandler.gui.MainMenuEventHandler;
import biomesoplenty.common.eventhandler.gui.StartupWarningEventHandler;
import biomesoplenty.common.eventhandler.misc.CapeEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler;
@ -45,7 +45,7 @@ public class BOPEventHandlers
private static void registerGUIEventHandlers()
{
MinecraftForge.EVENT_BUS.register(StartupWarningEventHandler.instance);
MinecraftForge.EVENT_BUS.register(new MainMenuOverrideEventHandler());
MinecraftForge.EVENT_BUS.register(new MainMenuEventHandler());
}
private static void registerMiscEventHandlers()

View file

@ -1,20 +1,23 @@
package biomesoplenty.client.gui;
package biomesoplenty.common.eventhandler.gui;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import biomesoplenty.common.helpers.BOPReflectionHelper;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiOpenEvent;
import biomesoplenty.common.helpers.BOPReflectionHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class GuiMainMenuBOP extends GuiMainMenu
public class MainMenuEventHandler
{
public static ResourceLocation[] bopTitlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_0.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_1.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_2.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_3.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_4.png"), new ResourceLocation("biomesoplenty:textures/gui/title/background/panorama_5.png")};
public GuiMainMenuBOP()
{
super();
@SubscribeEvent
public void openMainMenu(GuiOpenEvent event)
{
if (event.gui instanceof GuiMainMenu)
{
GuiMainMenu mainMenu = (GuiMainMenu)event.gui;
BOPReflectionHelper.setPrivateFinalValue(GuiMainMenu.class, this, bopTitlePanoramaPaths, "titlePanoramaPaths", "field_73978_o");
}
BOPReflectionHelper.setPrivateFinalValue(GuiMainMenu.class, mainMenu, bopTitlePanoramaPaths, "titlePanoramaPaths", "field_73978_o");
}
}
}

View file

@ -1,18 +0,0 @@
package biomesoplenty.common.eventhandler.gui;
import biomesoplenty.client.gui.GuiMainMenuBOP;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraftforge.client.event.GuiOpenEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class MainMenuOverrideEventHandler
{
@SubscribeEvent
public void openMainMenu(GuiOpenEvent event)
{
if (event.gui instanceof GuiMainMenu)
{
event.gui = new GuiMainMenuBOP();
}
}
}