Search in sources :

Example 1 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project BluePower by Qmunity.

the class BluePower method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    event.getModMetadata().version = Refs.fullVersionString();
    log = event.getModLog();
    config = new Configuration(event.getSuggestedConfigurationFile());
    BPApi.init(new BluePowerAPI());
    // Load configs
    Config.syncConfig(config);
    BPEnchantments.init();
    CompatibilityUtils.preInit(event);
    FMLCommonHandler.instance().bus().register(new Config());
    BPEventHandler eventHandler = new BPEventHandler();
    MinecraftForge.EVENT_BUS.register(eventHandler);
    FMLCommonHandler.instance().bus().register(eventHandler);
    MinecraftForge.EVENT_BUS.register(new WorldConversionEventHandler());
    RedstoneApi.getInstance().registerRedstoneProvider(new RedstoneProviderQmunityLib());
}
Also used : Configuration(net.minecraftforge.common.config.Configuration) Config(com.bluepowermod.init.Config) BPEventHandler(com.bluepowermod.event.BPEventHandler) WorldConversionEventHandler(com.bluepowermod.convert.WorldConversionEventHandler) RedstoneProviderQmunityLib(com.bluepowermod.redstone.RedstoneProviderQmunityLib) BPEventHandler(com.bluepowermod.event.BPEventHandler) WorldConversionEventHandler(com.bluepowermod.convert.WorldConversionEventHandler) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 2 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project BluePower by Qmunity.

the class BluePower method init.

@EventHandler
public void init(FMLInitializationEvent event) {
    PartManager.registerParts();
    BPBlocks.init();
    BPItems.init();
    PartManager.registerItems();
    TileEntities.init();
    OreDictionarySetup.init();
    GameRegistry.registerWorldGenerator(new WorldGenerationHandler(), 0);
    proxy.init();
    BPNetworkHandler.initBP();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GUIHandler());
    CompatibilityUtils.init(event);
    Achievements.init();
}
Also used : WorldGenerationHandler(com.bluepowermod.world.WorldGenerationHandler) GUIHandler(com.bluepowermod.client.gui.GUIHandler) BPEventHandler(com.bluepowermod.event.BPEventHandler) WorldConversionEventHandler(com.bluepowermod.convert.WorldConversionEventHandler) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 3 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project Engine by VoltzEngine-Project.

the class Engine method loadCompleteEvent.

@EventHandler
public void loadCompleteEvent(FMLLoadCompleteEvent event) {
    //Clean up resources to free up ram
    loader.loadComplete();
    long time = System.nanoTime();
    Engine.logger().error("Checking ore dictionary for bad values");
    //Fix ore dictionary
    String[] oreNames = OreDictionary.getOreNames();
    for (String name : oreNames) {
        ArrayList<ItemStack> stacks = OreDictionary.getOres(name);
        for (ItemStack stack : stacks) {
            if (stack == null || stack.getItem() == null) {
                Engine.logger().error("\tFound bad ore dictionary value stack='" + stack + "'  ore_name='" + name + "'");
            }
        }
    }
    time = System.nanoTime() - time;
    Engine.logger().error("Done.... took: " + StringHelpers.formatNanoTime(time));
}
Also used : MRHandlerItemStack(com.builtbroken.mc.lib.recipe.item.MRHandlerItemStack) ItemStack(net.minecraft.item.ItemStack) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 4 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project SecurityCraft by Geforce132.

the class mod_SecurityCraft method serverStarting.

// public static Item testChestplate;
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
    event.registerServerCommand(new CommandSCHelp());
    event.registerServerCommand(new CommandModule());
    if (this.debuggingMode) {
        event.registerServerCommand(new CommandSCLog());
    }
}
Also used : CommandModule(org.freeforums.geforce.securitycraft.commands.CommandModule) CommandSCHelp(org.freeforums.geforce.securitycraft.commands.CommandSCHelp) CommandSCLog(org.freeforums.geforce.securitycraft.commands.CommandSCLog) ForgeEventHandler(org.freeforums.geforce.securitycraft.handlers.ForgeEventHandler) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 5 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project NewHorizonsCoreMod by GTNewHorizons.

the class MainRegistry method PreLoad.

@EventHandler
public void PreLoad(FMLPreInitializationEvent PreEvent) {
    Logger.setDebugOutput(true);
    Rnd = new Random(System.currentTimeMillis());
    // ------------------------------------------------------------
    // Init coremod config file. Create it if it's not there
    CoreConfig = new CoreModConfig(PreEvent.getModConfigurationDirectory(), Refstrings.COLLECTIONID, Refstrings.MODID);
    if (!CoreConfig.LoadConfig())
        Logger.error(String.format("%s could not load its config file. Things are going to be weird!", Refstrings.MODID));
    if (CoreConfig.ModAdminErrorLogs_Enabled) {
        Logger.debug("Module_AdminErrorLogs is enabled");
        Module_AdminErrorLogs = new IngameErrorLog();
    }
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Init NetworkChannel");
    NW = new CoreModDispatcher();
    NW.registerPackets();
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Init itemmanager");
    ItemManager = new ModItemManager(Refstrings.MODID);
    BlockManager = new ModBlockManager(Refstrings.MODID);
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Init Tabmanager");
    TabManager = new CreativeTabsManager();
    ModTabList.InitModTabs(TabManager, ItemManager);
    //Materials init
    if (!GT_Mod.gregtechproxy.mEnableAllMaterials)
        new GT_CoreModSupport();
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Create Items");
    if (!ItemList.AddToItemManager(ItemManager)) {
        Logger.warn("Some items failed to register. Check the logfile for details");
        AddLoginError("[CoreMod-Items] Some items failed to register. Check the logfile for details");
    }
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.info("PRELOAD Create Blocks");
    if (!BlockList.AddToItemManager(BlockManager)) {
        Logger.warn("Some blocks failed to register. Check the logfile for details");
        AddLoginError("[CoreMod-Blocks] Some blocks failed to register. Check the logfile for details");
    }
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    // Init Modules
    Logger.debug("PRELOAD Init Modules");
    if (CoreConfig.ModHazardousItems_Enabled) {
        Logger.debug("Module_HazardousItems is enabled");
        Module_HazardousItems = new HazardousItemsHandler();
    // Module_HazardousItems.LoadConfig();
    }
    if (CoreConfig.ModCustomToolTips_Enabled) {
        Logger.debug("Module_HazardousItems is enabled");
        Module_CustomToolTips = new CustomToolTipsHandler();
    // Module_CustomToolTips.LoadConfig();
    }
    if (CoreConfig.ModCustomFuels_Enabled) {
        Logger.debug("Module_CustomFuels is enabled");
        Module_CustomFuels = new CustomFuelsHandler();
    // Module_CustomFuels.LoadConfig();
    }
    if (CoreConfig.ModCustomDrops_Enabled) {
        Logger.debug("Module_CustomDrops is enabled");
        Module_CustomDrops = new CustomDropsHandler(PreEvent.getModConfigurationDirectory());
    }
    // ------------------------------------------------------------
    // ------------------------------------------------------------
    Logger.debug("PRELOAD Create Fluids");
    FluidManager = new ModFluidManager(Refstrings.MODID);
    if (!FluidList.AddToItemManager(FluidManager)) {
        Logger.warn("Some fluids failed to register. Check the logfile for details");
        AddLoginError("[CoreMod-Fluids] Some fluids failed to register. Check the logfile for details");
    }
    // ------------------------------------------------------------
    // register final list with valid items to forge
    Logger.debug("LOAD Register Items");
    ItemManager.RegisterItems(TabManager);
    Logger.debug("LOAD Register Blocks");
    BlockManager.RegisterItems(TabManager);
    Logger.debug("LOAD Register Fluids");
    FluidManager.RegisterItems(TabManager);
    // register all non-enum items
    Logger.debug("LOAD Register non enum Items");
    if (!RegisterNonEnumItems()) {
        Logger.error("Some extended items could not be registered to the game registry");
        AddLoginError("[CoreMod-Items] Some extended items could not be registered to the game registry");
    }
    if (PreEvent.getSide() == Side.CLIENT) {
        FMLCommonHandler.instance().bus().register(new NotificationTickHandler());
    }
}
Also used : NotificationTickHandler(eu.usrv.yamcore.client.NotificationTickHandler) GT_CoreModSupport(com.dreammaster.gthandler.GT_CoreModSupport) CustomDropsHandler(com.dreammaster.modcustomdrops.CustomDropsHandler) CustomFuelsHandler(com.dreammaster.modcustomfuels.CustomFuelsHandler) CoreModConfig(com.dreammaster.config.CoreModConfig) ModBlockManager(eu.usrv.yamcore.blocks.ModBlockManager) CreativeTabsManager(eu.usrv.yamcore.creativetabs.CreativeTabsManager) IngameErrorLog(eu.usrv.yamcore.auxiliary.IngameErrorLog) CoreModDispatcher(com.dreammaster.network.CoreModDispatcher) ModItemManager(eu.usrv.yamcore.items.ModItemManager) Random(java.util.Random) HazardousItemsHandler(com.dreammaster.modhazardousitems.HazardousItemsHandler) ModFluidManager(eu.usrv.yamcore.fluids.ModFluidManager) CustomToolTipsHandler(com.dreammaster.modctt.CustomToolTipsHandler) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Aggregations

EventHandler (cpw.mods.fml.common.Mod.EventHandler)34 ItemStack (net.minecraft.item.ItemStack)8 Configuration (net.minecraftforge.common.config.Configuration)5 WorldConversionEventHandler (com.bluepowermod.convert.WorldConversionEventHandler)4 BPEventHandler (com.bluepowermod.event.BPEventHandler)4 MRHandlerItemStack (com.builtbroken.mc.prefab.recipe.item.MRHandlerItemStack)3 ServerCommandManager (net.minecraft.command.ServerCommandManager)3 IWorkerThread (com.builtbroken.mc.api.process.IWorkerThread)2 IMCMessage (cpw.mods.fml.common.event.FMLInterModComms.IMCMessage)2 MissingMapping (cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping)2 ICommandManager (net.minecraft.command.ICommandManager)2 AMConfig (am2.configuration.AMConfig)1 SkillConfiguration (am2.configuration.SkillConfiguration)1 GUIHandler (com.bluepowermod.client.gui.GUIHandler)1 Config (com.bluepowermod.init.Config)1 RedstoneProviderQmunityLib (com.bluepowermod.redstone.RedstoneProviderQmunityLib)1 RedstoneProviderVanilla (com.bluepowermod.redstone.RedstoneProviderVanilla)1 WorldGenerationHandler (com.bluepowermod.world.WorldGenerationHandler)1 ProxyASMTest (com.builtbroken.mc.core.asm.ProxyASMTest)1 BlockHeatedStone (com.builtbroken.mc.core.content.blocks.BlockHeatedStone)1