cpw.mods.fml.common.Mod Java Examples

The following examples show how to use cpw.mods.fml.common.Mod. 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 check out the related API usage on the sidebar.
Example #1
Source File: OpenPeripheralCore.java    From OpenPeripheral with 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 #2
Source File: MainMod.java    From bartworks with 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 #3
Source File: AdvancedMod.java    From AdvancedMod with 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 File: AdvancedMod.java    From AdvancedMod with 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 File: MainRegistry.java    From NewHorizonsCoreMod with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 #6
Source File: LetsModReboot.java    From LetsModReboot with 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 #7
Source File: QCraft.java    From qcraft-mod with 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 #8
Source File: OmniOcular.java    From OmniOcular with 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 #9
Source File: GardenTrees.java    From GardenCollection with 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 #10
Source File: GardenTrees.java    From GardenCollection with 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 #11
Source File: GardenStuff.java    From GardenCollection with 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 #12
Source File: BartWorksCrossmod.java    From bartworks with 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 #13
Source File: LetsModReboot.java    From LetsModReboot with 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 #14
Source File: WailaNBT.java    From wailanbt with 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 #15
Source File: WailaNBT.java    From wailanbt with 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 #16
Source File: WRCoreClientProxy.java    From WirelessRedstone with 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 #17
Source File: OpenPeripheralCore.java    From OpenPeripheral with 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 #18
Source File: DevCapesDemo.java    From DeveloperCapes with 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 #19
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 #20
Source File: BartWorksCrossmod.java    From bartworks with 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 #21
Source File: BartWorksCrossmod.java    From bartworks with 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 #22
Source File: MainMod.java    From bartworks with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void onModLoadingComplete(FMLLoadCompleteEvent event) {
    removeIC2Recipes();
    StaticRecipeChangeLoaders.addElectricImplosionCompressorRecipes();
    PlatinumSludgeOverHaul.replacePureElements();

    runOnServerStarted();
    StaticRecipeChangeLoaders.unificationRecipeEnforcer();
}
 
Example #23
Source File: Main.java    From ehacks-pro with 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 #24
Source File: MainRegistry.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
@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 #25
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 #26
Source File: ForgeMain.java    From FastAsyncWorldedit with 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 #27
Source File: GardenStuff.java    From GardenCollection with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void postInit (FMLPostInitializationEvent event) {
    proxy.postInit();
    recipes.init();
    integration.postInit();
}
 
Example #28
Source File: Gadomancy.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void onConstruct(FMLConstructionEvent event) {
    GadomancyApi.setInstance(new DefaultApiHandler());
    proxy.onConstruct();
}
 
Example #29
Source File: OpenPeripheralCore.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void loadComplete(FMLLoadCompleteEvent evt) {
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_COMPUTER_CRAFT)) ModuleComputerCraft.registerProvider();
}
 
Example #30
Source File: OpenPeripheralCore.java    From OpenPeripheral with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
	if (ArchitectureChecker.INSTANCE.isEnabled(Constants.ARCH_OPEN_COMPUTERS)) ModuleOpenComputers.registerProvider();
}