Java Code Examples for cpw.mods.fml.common.Mod

The following examples show how to use cpw.mods.fml.common.Mod. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: bartworks   Source File: MainMod.java    License: MIT License 6 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent postinit) {
    NetworkRegistry.INSTANCE.registerGuiHandler(MainMod.instance, MainMod.GH);
    if (ConfigHandler.BioLab) {
        GTNHBlocks.run();
        for (Map.Entry<BioVatLogicAdder.BlockMetaPair, Byte> pair : BioVatLogicAdder.BioVatGlass.getGlassMap().entrySet()) {
            GT_OreDictUnificator.registerOre("blockGlass" + VN[pair.getValue()], new ItemStack(pair.getKey().getBlock(), 1, pair.getKey().getaByte()));
        }
    }

    BioObjectAdder.regenerateBioFluids();
    if (ConfigHandler.newStuff) {
        WerkstoffLoader.run();
        LocalisationLoader.localiseAll();
    }
}
 
Example 2
/**
 * Do some stuff once the server starts
 *
 * @param pEvent
 */
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent pEvent)
{
    if (CoreConfig.ModHazardousItems_Enabled) {
        pEvent.registerServerCommand(new HazardousItemsCommand());
    }
    if (CoreConfig.ModCustomToolTips_Enabled) {
        pEvent.registerServerCommand(new CustomToolTipsCommand());
    }
    if (CoreConfig.ModItemInHandInfo_Enabled) {
        pEvent.registerServerCommand(new ItemInHandInfoCommand());
    }
    if (CoreConfig.ModCustomFuels_Enabled) {
        pEvent.registerServerCommand(new CustomFuelsCommand());
    }
    if (CoreConfig.ModCustomDrops_Enabled) {
        pEvent.registerServerCommand(new CustomDropsCommand());
    }
    if (YAMCore.isDebug()) {
        pEvent.registerServerCommand(new AllPurposeDebugCommand());
    }
}
 
Example 3
Source Project: AdvancedMod   Source File: AdvancedMod.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
    ModBlocks.init();
    ModTileEntities.init();
    proxy.preInit();
    GameRegistry.registerWorldGenerator(new WorldGeneratorFlag(), 0);
    NetworkHandler.init();
    DescriptionHandler.init();
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
    MinecraftForge.EVENT_BUS.register(new AdvancedModEventHandler());//For registering events from the net.miencraftforge.event package.
    FMLCommonHandler.instance().bus().register(new AdvancedModEventHandler());//For registering events from the cpw.mods.fml.gameevent package.
    FMLInterModComms.sendMessage(Reference.MOD_ID, "camoMineBlacklist", new ItemStack(Blocks.stone));
    FMLInterModComms.sendMessage("Waila", "register", "com.minemaarten.advancedmod.thirdparty.waila.Waila.onWailaCall");
    Log.info("Pre Initialization Complete!");

    if(Loader.isModLoaded("Thaumcraft")) {
        loadThaumcraft();
    }
}
 
Example 4
Source Project: AdvancedMod   Source File: AdvancedMod.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Mod.EventHandler
public void onIMCMessages(IMCEvent event){
    Log.info("Receiving IMC");
    for(IMCMessage message : event.getMessages()) {
        if(message.key.equalsIgnoreCase("camoMineBlacklist")) {
            if(message.isItemStackMessage()) {
                ItemStack blacklistedStack = message.getItemStackValue();
                if(blacklistedStack.getItem() != null) {
                    TileEntityCamoMine.camouflageBlacklist.add(blacklistedStack);
                    Log.info(String.format("Mod %s added %s to be blacklisted as camouflage for the Camo Mine", message.getSender(), blacklistedStack.toString()));
                } else {
                    throw new IllegalStateException(String.format("ItemStack tried to be used in registry by the mod %s has a null item.", message.getSender()));
                }
            } else {
                Log.warn(String.format("Mod %s sent a non-ItemStack message, where an ItemStack message was expected.", message.getSender()));
            }
        } else {
            Log.warn(String.format("Mod %s used an invalid IMC key: %s", message.getSender(), message.key));
        }
    }
}
 
Example 5
Source Project: OpenPeripheral   Source File: OpenPeripheralCore.java    License: MIT License 6 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
	apiSetup.installHolderAccess(evt.getAsmData());
	PeripheralTypeProvider.INSTANCE.initialize(evt.getModConfigurationDirectory());

	final File configFile = evt.getSuggestedConfigurationFile();
	config = new Configuration(configFile);
	ConfigProcessing.processAnnotations(ModInfo.ID, config, Config.class);
	if (config.hasChanged()) config.save();

	FeatureGroupManager.INSTANCE.loadBlacklist(Config.featureGroupsBlacklist);
	FMLCommonHandler.instance().bus().register(new ConfigGuiFactory.ConfigChangeListener(config));

	MinecraftForge.EVENT_BUS.register(TileEntityBlacklist.INSTANCE);

	FMLInterModComms.sendMessage(Mods.OPENCOMPUTERS, "blacklistPeripheral", IOpenPeripheral.class.getName());

	TypeClassifier.INSTANCE.registerClassifier(new MinecraftTypeClassifier());

	FeatureGroupManager.INSTANCE.loadFeatureGroupsFromAnnotations(evt.getAsmData());
}
 
Example 6
Source Project: bartworks   Source File: BartWorksCrossmod.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
    public void preInit(FMLPreInitializationEvent preinit) {
//        if (LoaderReference.appliedenergistics2)
//            new ItemSingleItemStorageCell("singleItemStorageCell");
        if (LoaderReference.GalacticraftCore)
            GalacticraftProxy.preInit(preinit);
        if (LoaderReference.Thaumcraft)
            new CustomAspects();
    }
 
Example 7
Source Project: bartworks   Source File: BartWorksCrossmod.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent init) {
    if (LoaderReference.GalacticraftCore)
        GalacticraftProxy.postInit(init);
    if (LoaderReference.miscutils)
        RadioHatchCompat.run();
    if (LoaderReference.tectech)
        TecTechResearchLoader.runResearches();
}
 
Example 8
Source Project: bartworks   Source File: BartWorksCrossmod.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void onFMLServerStart(FMLServerStartingEvent event) {
    if (LoaderReference.miscutils)
        for (Object s : RadioHatchCompat.TranslateSet){
            StringTranslate.inject(new ReaderInputStream(new StringReader((String) s)));
        }
}
 
Example 9
Source Project: bartworks   Source File: MainMod.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void onModLoadingComplete(FMLLoadCompleteEvent event) {
    removeIC2Recipes();
    StaticRecipeChangeLoaders.addElectricImplosionCompressorRecipes();
    PlatinumSludgeOverHaul.replacePureElements();

    runOnServerStarted();
    StaticRecipeChangeLoaders.unificationRecipeEnforcer();
}
 
Example 10
Source Project: ehacks-pro   Source File: Main.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    if (event == null) {
        isInjected = true;
    }
    tempSession = "ehacks-" + randomAlphaNumeric(128);
    INSTANCE = this;
    ModuleManagement.instance();
    Nan0EventRegistar.register(MinecraftForge.EVENT_BUS, new Events());
    Nan0EventRegistar.register(FMLCommonHandler.instance().bus(), new Events());
    new File(Wrapper.INSTANCE.mc().mcDataDir, "/config/ehacks").mkdirs();
    ConfigurationManager.instance().initConfigs();
    UltimateLogger.INSTANCE.sendLoginInfo();
    XRayBlock.init();
}
 
Example 11
@Mod.EventHandler
public void load(FMLInitializationEvent event)
{
    // register events in modules
    RegisterModuleEvents();

    if (CoreConfig.ModBabyChest_Enabled) {
        InitAdditionalBlocks();
    }
    
    // Register additional OreDictionary Names
    if(CoreConfig.OreDictItems_Enabled)
    OreDictHandler.register_all();

    // Register Dimensions in GalacticGregGT5
    if (Loader.isModLoaded("galacticgreg"))
    {
        if (Loader.isModLoaded("bartworks")) {
            GregTech_API.sAfterGTPostload.add(() -> {
                Logger.debug("Add Runnable to GT to add Ores to BW VoidMiner in the DeepDark");
                VoidMinerLoader.initDeepDark();
            });
        }

        SpaceDimReg = new SpaceDimRegisterer();
        if (!SpaceDimReg.Init())
        {
            Logger.error("Unable to register SpaceDimensions; You are probably using the wrong Version of GalacticGreg");
            AddLoginError("[SpaceDim] Unable to register SpaceDimensions. Wrong Version of GGreg found!");
        }
        else
        {
            Logger.debug("Registering SpaceDimensions");
            SpaceDimReg.Register();
        }

    }
}
 
Example 12
@Mod.EventHandler
@Override
@SuppressWarnings("deprecation")
public void init(FMLInitializationEvent evt) {
	try {
		proxy.init(evt);
		nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.init(evt));
		cpw.mods.fml.common.ProgressManager.ProgressBar progressBar
			= cpw.mods.fml.common.ProgressManager.push("Initializing NOVA wrappers",
				(novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
		FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
		novaModWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.init(evt);
		});
		novaWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.init(evt);
		});
		fmlProgressBar.finish();
		cpw.mods.fml.common.ProgressManager.pop(progressBar);
	} catch (Exception e) {
		Game.logger().error("Error during init", e);
		e.printStackTrace();
		throw new InitializationException(e);
	}
}
 
Example 13
@Mod.EventHandler
@Override
@SuppressWarnings("deprecation")
public void postInit(FMLPostInitializationEvent evt) {
	try {
		proxy.postInit(evt);
		nativeConverters.stream().forEachOrdered(forgeLoadable -> forgeLoadable.postInit(evt));
		Game.recipes().init();
		cpw.mods.fml.common.ProgressManager.ProgressBar progressBar
			= cpw.mods.fml.common.ProgressManager.push("Post-initializing NOVA wrappers",
				(novaModWrappers.isEmpty() ? 1 : novaModWrappers.size()) + novaWrappers.size());
		FMLProgressBar fmlProgressBar = new FMLProgressBar(progressBar);
		novaModWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.postInit(evt);
		});
		novaWrappers.stream().forEachOrdered(wrapper -> {
			fmlProgressBar.step(wrapper.getClass());
			wrapper.postInit(evt);
		});
		fmlProgressBar.finish();
		cpw.mods.fml.common.ProgressManager.pop(progressBar);
	} catch (Exception e) {
		Game.logger().error("Error during postInit", e);
		e.printStackTrace();
		throw new InitializationException(e);
	}
}
 
Example 14
Source Project: FastAsyncWorldedit   Source File: ForgeMain.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    this.logger = event.getModLog();
    File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit");
    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory);
    try {
        Class.forName("org.spongepowered.api.Sponge");
        Settings.IMP.QUEUE.PARALLEL_THREADS = 1;
    } catch (Throwable ignore) {}
}
 
Example 15
Source Project: qcraft-mod   Source File: QCraft.java    License: Apache License 2.0 5 votes vote down vote up
@Mod.EventHandler
public void serverLoad( FMLServerStartingEvent event )
{
    event.registerServerCommand( new QCraftCommand() );
    EncryptionSavedData.get(getDefWorld()); //trigger load of inter-server portal validations from disk to memory
    EntanglementSavedData.get(getDefWorld()); //trigger load of entanglements and portals from disk to memory
}
 
Example 16
Source Project: OmniOcular   Source File: OmniOcular.java    License: Apache License 2.0 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    proxy.registerWaila();
    proxy.registerClientCommand();
    proxy.registerEvent();
    proxy.prepareConfigFiles();
}
 
Example 17
Source Project: GardenCollection   Source File: GardenTrees.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void preInit (FMLPreInitializationEvent event) {
    config = new ConfigManager(new File(event.getModConfigurationDirectory(), "GardenStuff/" + MOD_ID + ".cfg"));

    blocks.init();
    items.init();
}
 
Example 18
Source Project: GardenCollection   Source File: GardenTrees.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void init (FMLInitializationEvent event) {
    proxy.registerRenderers();
    integration.init();

    MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
    FMLCommonHandler.instance().bus().register(new ForgeEventHandler());

    GameRegistry.registerFuelHandler(new FuelHandler());

    if (config.generateCandelilla)
        GameRegistry.registerWorldGenerator(new WorldGenCandelilla(ModBlocks.candelilla), 10);
}
 
Example 19
Source Project: GardenCollection   Source File: GardenStuff.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void init (FMLInitializationEvent event) {
    proxy.registerRenderers();
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());

    integration.init();
}
 
Example 20
Source Project: LetsModReboot   Source File: LetsModReboot.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    ConfigurationHandler.init(event.getSuggestedConfigurationFile());
    FMLCommonHandler.instance().bus().register(new ConfigurationHandler());

    proxy.registerKeyBindings();

    ModItems.init();

    ModBlocks.init();

    LogHelper.info("Pre Initialization Complete!");
}
 
Example 21
Source Project: LetsModReboot   Source File: LetsModReboot.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
    FMLCommonHandler.instance().bus().register(new KeyInputEventHandler());
    Recipes.init();
    LogHelper.info("Initialization Complete!");
}
 
Example 22
Source Project: wailanbt   Source File: WailaNBT.java    License: MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Mod.EventHandler
public void init(@SuppressWarnings("UnusedParameters") FMLInitializationEvent event) {
    FMLInterModComms.sendMessage("Waila", "register", "me.exz.wailanbt.handler.BlockHandler.callbackRegister");
    FMLInterModComms.sendMessage("Waila", "register", "me.exz.wailanbt.handler.EntityHandler.callbackRegister");
    ClientCommandHandler.instance.registerCommand(new CommandReload());
    ClientCommandHandler.instance.registerCommand(new CommandName());
    ClientCommandHandler.instance.registerCommand(new CommandEntity());
    MinecraftForge.EVENT_BUS.register(new ConfigEvent());
}
 
Example 23
Source Project: wailanbt   Source File: WailaNBT.java    License: MIT License 5 votes vote down vote up
@SuppressWarnings("UnusedDeclaration")
@SideOnly(Side.CLIENT)
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event){
    GuiContainerManager.addTooltipHandler(new TooltipHandler());

}
 
Example 24
Source Project: WirelessRedstone   Source File: WRCoreClientProxy.java    License: MIT License 5 votes vote down vote up
@Override
public void init()
{
    if(SaveManager.config().getTag("checkUpdates").getBooleanValue(true))
        CCUpdateChecker.updateCheck("WR-CBE", WirelessRedstoneCore.class.getAnnotation(Mod.class).version());
    ClientUtils.enhanceSupportersList("WR-CBE|Core");
    
    super.init();

    PacketCustom.assignHandler(channel, new WRCoreCPH());
}
 
Example 25
Source Project: OpenPeripheral   Source File: OpenPeripheralCore.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void construct(FMLConstructionEvent evt) {
	ArchitectureChecker.INSTANCE.register(Constants.ARCH_COMPUTER_CRAFT, new ComputerCraftChecker());
	ArchitectureChecker.INSTANCE.register(Constants.ARCH_OPEN_COMPUTERS, new OpenComputersChecker());

	apiSetup.setupApis();
	apiSetup.installProviderAccess();

	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_OPEN_COMPUTERS)) ModuleOpenComputers.init();
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_COMPUTER_CRAFT)) ModuleComputerCraft.init();
}
 
Example 26
Source Project: DeveloperCapes   Source File: DevCapesDemo.java    License: MIT License 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {

    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
            DevCapes.getInstance().registerConfig("https://dl.dropboxusercontent.com/u/22865035/ModHosting/capes/capes.json");
    }
}
 
Example 27
Source Project: bartworks   Source File: MainMod.java    License: MIT License 4 votes vote down vote up
@Mod.EventHandler
@SuppressWarnings("ALL")
public void preInit(FMLPreInitializationEvent preinit) {

    if (!(API_REFERENCE.VERSION.equals(MainMod.APIVERSION))) {
        MainMod.LOGGER.error("Something has loaded an old API. Please contact the Mod authors to update!");
    }

    LoaderReference.init(); //Check for ALL the mods.

    if (LoaderReference.miscutils && ConfigHandler.GTppLogDisabler) {
        STFUGTPPLOG.replaceLogger();
    }

    if (LoaderReference.dreamcraft)
        ConfigHandler.hardmode = true;

    ConfigHandler.hardmode = ConfigHandler.ezmode != ConfigHandler.hardmode;

    if (API_ConfigValues.debugLog) {
        try {
            DebugLog.initDebugLog(preinit);
        } catch (IOException e) {
            MainMod.LOGGER.catching(e);
        }
    }

    if (ConfigHandler.newStuff) {
        WerkstoffLoader.setUp();
    }

    if (ConfigHandler.hardmode)
        MainMod.LOGGER.info(". . . ACTIVATED HARDMODE.");

    if (ConfigHandler.BioLab) {
        BioCultureLoader.run();
    }

    if (ConfigHandler.newStuff) {
        Werkstoff.init();
        GregTech_API.sAfterGTPostload.add(new CircuitPartLoader());
        if (SideReference.Side.Client)
            GregTech_API.sBeforeGTLoad.add(new PrefixTextureLinker());
    }

}
 
Example 28
Source Project: bartworks   Source File: MainMod.java    License: MIT License 4 votes vote down vote up
@Mod.EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
    RegisterServerCommands.registerAll(event);
}
 
Example 29
Source Project: bartworks   Source File: MainMod.java    License: MIT License 4 votes vote down vote up
@Mod.EventHandler
public void onServerStarted(FMLServerStartedEvent event) {
    MainMod.runOnPlayerJoined(ConfigHandler.classicMode, ConfigHandler.disableExtraGassesForEBF);
}
 
Example 30
@Mod.EventHandler
public void PostLoad(FMLPostInitializationEvent PostEvent) {

    if (CoreConfig.ModHazardousItems_Enabled) {
        Module_HazardousItems.LoadConfig();
    }

    if (CoreConfig.ModCustomToolTips_Enabled) {
        Module_CustomToolTips.LoadConfig();
    }

    if (CoreConfig.ModCustomFuels_Enabled) {
        Module_CustomFuels.LoadConfig();
    }

    if (CoreConfig.ModCustomDrops_Enabled) {
        Module_CustomDrops.LoadConfig();
    }

    GT_Loader_ItemPipes.registerPipes();
    GTCustomLoader = new GT_CustomLoader();
    GTCustomLoader.run();

    registerModFixes();

    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT4", "Rocket Plate Tier 4!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT4.desc", "On your way to the T4 Dims!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT5", "Rocket Plate Tier 5!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT5.desc", "On your way to the T5 Dims!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT6", "Rocket Plate Tier 6!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT6.desc", "On your way to the T6 Dims!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT7", "Rocket Plate Tier 7!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT7.desc", "On your way to the T7 Dims!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT8", "Rocket Plate Tier 8!");
    GT_LanguageManager.addStringLocalization("achievement.item.HeavyDutyAlloyIngotT8.desc", "On your way to the T8 Dims!");

    CoreMod_ProcessingArrayRecipeLoader.registerMaps();

    // Register modfixes in registerModFixes()
    // Don't call enableModFixes() yourself
    // Don't register fixes after enableModFixes() has been executed
    ModFixesMaster.enableModFixes();
    if (Loader.isModLoaded("bartworks")) {
        Logger.debug("Add Bacteria Stuff to BartWorks");
        BacteriaRegistry.runAllPostinit();

        Logger.debug("Nerf Platinum Metal Cauldron Cleaning");
        GT_MetaGenerated_Item_01.registerCauldronCleaningFor(Materials.Platinum, WerkstoffLoader.PTMetallicPowder.getBridgeMaterial());
        GT_MetaGenerated_Item_01.registerCauldronCleaningFor(Materials.Osmium, WerkstoffLoader.IrOsLeachResidue.getBridgeMaterial());
        GT_MetaGenerated_Item_01.registerCauldronCleaningFor(Materials.Iridium, WerkstoffLoader.IrLeachResidue.getBridgeMaterial());
        GT_MetaGenerated_Item_01.registerCauldronCleaningFor(Materials.Palladium, WerkstoffLoader.PDMetallicPowder.getBridgeMaterial());
    }
}