Changed the title panorama to suit BOP better

This commit is contained in:
Adubbz 2014-01-14 22:55:00 +11:00
parent a034a6b7e7
commit f0c0a8070d
10 changed files with 146 additions and 81 deletions

View file

@ -0,0 +1,20 @@
package biomesoplenty.client.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;
public class GuiMainMenuBOP extends GuiMainMenu
{
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();
BOPReflectionHelper.setPrivateFinalValue(GuiMainMenu.class, this, bopTitlePanoramaPaths, "titlePanoramaPaths", "field_73978_o");
}
}

View file

@ -4,6 +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.StartupWarningEventHandler;
import biomesoplenty.common.eventhandler.misc.CapeEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler;
@ -44,6 +45,7 @@ public class BOPEventHandlers
private static void registerGUIEventHandlers()
{
MinecraftForge.EVENT_BUS.register(StartupWarningEventHandler.instance);
MinecraftForge.EVENT_BUS.register(new MainMenuOverrideEventHandler());
}
private static void registerMiscEventHandlers()

View file

@ -0,0 +1,18 @@
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();
}
}
}

View file

@ -1,13 +1,9 @@
package biomesoplenty.common.helpers;
import java.util.Arrays;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.collect.BiMap;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class BOPReflectionHelper
@ -25,4 +21,33 @@ public class BOPReflectionHelper
return ObfuscationReflectionHelper.getPrivateValue(classToAccess, instance, obfFieldName);
}
}
public static <T, E> void setPrivateFinalValue(Class <? super T > classToAccess, T instance, E value, String fieldName, String obfFieldName)
{
try
{
Field field = null;
try
{
Class.forName("net.minecraft.world.World");
field = ReflectionHelper.findField(classToAccess, fieldName);
}
catch (ClassNotFoundException e)
{
field = ReflectionHelper.findField(classToAccess, ObfuscationReflectionHelper.remapFieldNames(classToAccess.getName(), obfFieldName));
}
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(instance, value);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB