Fixed event handlers

This commit is contained in:
Adubbz 2014-06-29 13:58:47 +10:00
parent 95763a6b56
commit 80889091fd
7 changed files with 109 additions and 57 deletions

View file

@ -14,6 +14,7 @@ import biomesoplenty.common.core.BOPItems;
import biomesoplenty.common.core.BOPPackets;
import biomesoplenty.common.core.BOPPotions;
import biomesoplenty.common.core.BOPVanillaCompat;
import biomesoplenty.common.eventhandler.BOPEventHandlers;
import biomesoplenty.common.helpers.CreativeTabsBOP;
import biomesoplenty.common.integration.BOPIntegration;
import biomesoplenty.common.integration.TreecapitatorIntegration;
@ -67,7 +68,8 @@ public class BiomesOPlenty
BOPEntities.init();
BOPVanillaCompat.init();
proxy.registerEventHandlers();
BOPEventHandlers.init();
proxy.registerRenderers();
BOPIntegration.preInit();

View file

@ -39,7 +39,6 @@ import biomesoplenty.common.entities.EntityRosester;
import biomesoplenty.common.entities.EntityWasp;
import biomesoplenty.common.entities.projectiles.EntityDart;
import biomesoplenty.common.entities.projectiles.EntityMudball;
import biomesoplenty.common.eventhandler.gui.StartupWarningEventHandler;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
@ -103,14 +102,6 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerBlockHandler(new BambooRenderer());
}
@Override
public void registerEventHandlers()
{
MinecraftForge.EVENT_BUS.register(StartupWarningEventHandler.instance);
MinecraftForge.EVENT_BUS.register(new ParticleRegistry());
FMLCommonHandler.instance().bus().register(new FlowerScatterEventHandler());
}
@Override
public void spawnParticle(String string, double x, double y, double z)
{

View file

@ -1,11 +1,11 @@
package biomesoplenty;
import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.common.eventhandler.client.gui.MainMenuEventHandler;
import biomesoplenty.common.eventhandler.client.gui.StartupWarningEventHandler;
import biomesoplenty.common.eventhandler.entity.DyeEventHandler;
import biomesoplenty.common.eventhandler.entity.FlippersEventHandler;
import biomesoplenty.common.eventhandler.entity.TemptEventHandler;
import biomesoplenty.common.eventhandler.gui.MainMenuEventHandler;
import biomesoplenty.common.eventhandler.gui.StartupWarningEventHandler;
import biomesoplenty.common.eventhandler.misc.BonemealEventHandler;
import biomesoplenty.common.eventhandler.misc.BucketEventHandler;
import biomesoplenty.common.eventhandler.network.ConnectionEventHandler;
@ -25,24 +25,6 @@ public class CommonProxy
{
}
public void registerEventHandlers()
{
FMLCommonHandler.instance().bus().register(new ConnectionEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new DecorationModificationEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeSizeEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new MapGenEventHandler());
MinecraftForge.EVENT_BUS.register(new DyeEventHandler());
MinecraftForge.EVENT_BUS.register(new FlippersEventHandler());
MinecraftForge.EVENT_BUS.register(new TemptEventHandler());
MinecraftForge.EVENT_BUS.register(new PotionParalysisEventHandler());
MinecraftForge.EVENT_BUS.register(new PotionPossessionEventHandler());
MinecraftForge.EVENT_BUS.register(new MainMenuEventHandler());
MinecraftForge.EVENT_BUS.register(new BonemealEventHandler());
MinecraftForge.EVENT_BUS.register(new BucketEventHandler());
}
public void spawnParticle(String string, double x, double y, double z)
{
}

View file

@ -33,6 +33,9 @@ public class BOPObfuscationHelper
public static final String[] roofedForest = new String[] { "roofedForest", "field_150585_R" };
public static final String[] hell = new String[] { "hell", "field_76778_j" };
//GuiMainMenu
public static final String[] titlePanoramaPaths = new String[] { "titlePanoramaPaths", "field_73978_o" };
//Minecraft
public static final String[] fileAssets = new String[] { "fileAssets", "field_110446_Y" };
}

View file

@ -0,0 +1,76 @@
package biomesoplenty.common.eventhandler;
import net.minecraftforge.common.MinecraftForge;
import biomesoplenty.common.eventhandler.client.gui.MainMenuEventHandler;
import biomesoplenty.common.eventhandler.client.gui.StartupWarningEventHandler;
import biomesoplenty.common.eventhandler.entity.DyeEventHandler;
import biomesoplenty.common.eventhandler.entity.FlippersEventHandler;
import biomesoplenty.common.eventhandler.entity.TemptEventHandler;
import biomesoplenty.common.eventhandler.misc.BonemealEventHandler;
import biomesoplenty.common.eventhandler.misc.BucketEventHandler;
import biomesoplenty.common.eventhandler.network.ConnectionEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionPossessionEventHandler;
import biomesoplenty.common.eventhandler.world.BiomeSizeEventHandler;
import biomesoplenty.common.eventhandler.world.DecorationModificationEventHandler;
import biomesoplenty.common.eventhandler.world.MapGenEventHandler;
import biomesoplenty.common.eventhandler.world.VillageMaterialEventHandler;
import cpw.mods.fml.common.FMLCommonHandler;
public class BOPEventHandlers
{
public static void init()
{
registerNetworkEventHandlers();
registerWorldEventHandlers();
registerEntityEventHandlers();
registerPotionEventHandlers();
registerGUIEventHandlers();
registerMiscEventHandlers();
//registerClientEventHandlers();
}
private static void registerNetworkEventHandlers()
{
FMLCommonHandler.instance().bus().register(new ConnectionEventHandler());
}
private static void registerWorldEventHandlers()
{
MinecraftForge.TERRAIN_GEN_BUS.register(new DecorationModificationEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new BiomeSizeEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());
MinecraftForge.TERRAIN_GEN_BUS.register(new MapGenEventHandler());
}
private static void registerEntityEventHandlers()
{
MinecraftForge.EVENT_BUS.register(new DyeEventHandler());
MinecraftForge.EVENT_BUS.register(new FlippersEventHandler());
MinecraftForge.EVENT_BUS.register(new TemptEventHandler());
}
private static void registerPotionEventHandlers()
{
MinecraftForge.EVENT_BUS.register(new PotionParalysisEventHandler());
MinecraftForge.EVENT_BUS.register(new PotionPossessionEventHandler());
}
private static void registerGUIEventHandlers()
{
MinecraftForge.EVENT_BUS.register(StartupWarningEventHandler.instance);
MinecraftForge.EVENT_BUS.register(new MainMenuEventHandler());
}
private static void registerMiscEventHandlers()
{
MinecraftForge.EVENT_BUS.register(new BonemealEventHandler());
MinecraftForge.EVENT_BUS.register(new BucketEventHandler());
}
/*private static void registerClientEventHandlers()
{
MinecraftForge.EVENT_BUS.register(new ParticleRegistry());
FMLCommonHandler.instance().bus().register(new FlowerScatterEventHandler());
}*/
}

View file

@ -1,26 +1,24 @@
package biomesoplenty.common.eventhandler.gui;
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;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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")};
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void openMainMenu(GuiOpenEvent event)
{
if (event.gui instanceof GuiMainMenu)
{
GuiMainMenu mainMenu = (GuiMainMenu)event.gui;
BOPReflectionHelper.setPrivateFinalValue(GuiMainMenu.class, mainMenu, bopTitlePanoramaPaths, "titlePanoramaPaths", "field_73978_o");
}
}
}
package biomesoplenty.common.eventhandler.client.gui;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiOpenEvent;
import biomesoplenty.api.BOPObfuscationHelper;
import biomesoplenty.common.helpers.BOPReflectionHelper;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
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")};
@SubscribeEvent
public void openMainMenu(GuiOpenEvent event)
{
if (event.gui instanceof GuiMainMenu)
{
GuiMainMenu mainMenu = (GuiMainMenu)event.gui;
BOPReflectionHelper.setPrivateFinalValue(GuiMainMenu.class, mainMenu, bopTitlePanoramaPaths, BOPObfuscationHelper.titlePanoramaPaths);
}
}
}

View file

@ -1,4 +1,4 @@
package biomesoplenty.common.eventhandler.gui;
package biomesoplenty.common.eventhandler.client.gui;
import java.io.File;
import java.io.IOException;