Search in sources :

Example 11 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project ArsMagica2 by Mithion.

the class AMCore method init.

@EventHandler
public void init(FMLInitializationEvent event) {
    FMLInterModComms.sendMessage("Waila", "register", "am2.interop.WailaSupport.callbackRegister");
    ForgeChunkManager.setForcedChunkLoadingCallback(this, AMChunkLoader.INSTANCE);
    proxy.init();
    initAPI();
    if (AMCore.config.getEnableWitchwoodForest()) {
        BiomeDictionary.registerBiomeType(BiomeWitchwoodForest.instance, Type.FOREST, Type.MAGICAL);
        BiomeManager.warmBiomes.add(new BiomeEntry(BiomeWitchwoodForest.instance, 6));
    }
}
Also used : BiomeEntry(net.minecraftforge.common.BiomeManager.BiomeEntry) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 12 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project ArsMagica2 by Mithion.

the class AMCore method postInit.

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
    //Register Flicker Operators
    registerFlickerOperators();
    proxy.setCompendiumSaveBase(compendiumBase);
    proxy.postinit();
    if (config.retroactiveWorldgen()) {
        LogHelper.info("Retroactive Worldgen is enabled");
    }
    FluidContainerRegistry.registerFluidContainer(new FluidContainerData(FluidRegistry.getFluidStack(BlockLiquidEssence.liquidEssenceFluid.getName(), FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(ItemsCommonProxy.itemAMBucket), FluidContainerRegistry.EMPTY_BUCKET));
    SeventhSanctum.instance.init();
    /*if (Loader.isModLoaded("BetterDungeons"))
			BetterDungeons.init();*/
    if (Loader.isModLoaded("Thaumcraft"))
        TC4Interop.initialize();
/*if (Loader.isModLoaded("MineFactoryReloaded"))
			MFRInterop.init();*/
}
Also used : FluidContainerData(net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData) ItemStack(net.minecraft.item.ItemStack) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 13 with EventHandler

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

the class CompactSolars method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent preinit) {
    Version.init(preinit.getVersionProperties());
    preinit.getModMetadata().version = Version.version();
    Configuration cfg = new Configuration(preinit.getSuggestedConfigurationFile());
    try {
        cfg.load();
        Property block = cfg.getBlock("compactSolar", 650);
        block.comment = "The block id for the compact solar arrays.";
        compactSolarBlock = new BlockCompactSolar(block.getInt(650));
        CompactSolarType.buildHats(cfg, 19551);
        Property scale = cfg.get(Configuration.CATEGORY_GENERAL, "scaleFactor", 1);
        scale.comment = "The EU generation scaling factor. " + "The average number of ticks needed to generate one EU packet." + "1 is every tick, 2 is every other tick etc. " + "Each Solar will still generate a whole packet (8, 64, 512 EU).";
        productionRate = scale.getInt(1);
    } catch (Exception e) {
        FMLLog.log(Level.SEVERE, e, "CompactSolars was unable to load it's configuration successfully");
        throw new RuntimeException(e);
    } finally {
        cfg.save();
    }
}
Also used : Configuration(net.minecraftforge.common.Configuration) Property(net.minecraftforge.common.Property) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 14 with EventHandler

use of cpw.mods.fml.common.Mod.EventHandler in project ArsMagica2 by Mithion.

the class AMCore method onIMCReceived.

@EventHandler
public void onIMCReceived(FMLInterModComms.IMCEvent event) {
    for (IMCMessage msg : event.getMessages()) {
        if (msg.key == "dsb") {
            LogHelper.info("Received dimension spawn blacklist IMC!  Processing.");
            String[] split = msg.getStringValue().split("|");
            if (split.length != 2) {
                LogHelper.warn("Could not parse dsb IMC - malformed identifiers!  Syntax is 'ClassName|DimensionID', for example:  EntityDryad|22");
                continue;
            }
            try {
                SpawnBlacklists.addBlacklistedDimensionSpawn(split[0], Integer.parseInt(split[1]));
            } catch (NumberFormatException nex) {
                LogHelper.warn("Could not parse dsb IMC - improper dimension ID (not a number)!  Syntax is 'ClassName|DimensionID', for example:  EntityDryad|22");
            }
        } else if (msg.key == "bsb") {
            LogHelper.info("Received biome spawn blacklist IMC!  Processing.");
            String[] split = msg.getStringValue().split("|");
            if (split.length != 2) {
                LogHelper.warn("Could not parse bsb IMC - malformed identifiers!  Syntax is 'ClassName|BiomeID', for example:  EntityDryad|22");
                continue;
            }
            try {
                SpawnBlacklists.addBlacklistedBiomeSpawn(split[0], Integer.parseInt(split[1]));
            } catch (NumberFormatException nex) {
                LogHelper.warn("Could not parse bsb IMC - improper biome ID (not a number)!  Syntax is 'ClassName|BiomeID', for example:  EntityDryad|22");
            }
        } else if (msg.key == "dwg") {
            LogHelper.info("Received dimension worldgen blacklist IMC!  Processing.");
            try {
                SpawnBlacklists.addBlacklistedDimensionForWorldgen(Integer.parseInt(msg.getStringValue()));
            } catch (NumberFormatException nex) {
                LogHelper.warn("Could not parse dwg IMC - improper dimension ID (not a number)!  Syntax is 'dimensionID', for example:  2");
            }
        } else if (msg.key == "adb") {
            LogHelper.info("Received dispel blacklist IMC!  Processing.");
            try {
                BuffList.instance.addDispelExclusion(Integer.parseInt(msg.getStringValue()));
            } catch (NumberFormatException nex) {
                LogHelper.warn("Could not parse adb IMC - improper potion ID (not a number)!  Syntax is 'potionID', for example:  10");
            }
        }
    }
}
Also used : IMCMessage(cpw.mods.fml.common.event.FMLInterModComms.IMCMessage) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 15 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)9 WorldConversionEventHandler (com.bluepowermod.convert.WorldConversionEventHandler)4 BPEventHandler (com.bluepowermod.event.BPEventHandler)4 MRHandlerItemStack (com.builtbroken.mc.lib.recipe.item.MRHandlerItemStack)4 Configuration (net.minecraftforge.common.config.Configuration)4 ServerCommandManager (net.minecraft.command.ServerCommandManager)3 IWorkerThread (com.builtbroken.mc.api.process.IWorkerThread)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 ItemDevData (com.builtbroken.mc.core.content.debug.ItemDevData)1