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

The following examples show how to use cpw.mods.fml.common.Mod#EventHandler . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
Source File: MainRegistry.java    From NewHorizonsCoreMod with GNU General Public License v3.0 4 votes vote down vote up
@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());
    }
}
 
Example 12
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 13
Source File: ForgeMain.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    IMP.insertCommands();
}
 
Example 14
Source File: GardenStuff.java    From GardenCollection with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit (FMLPreInitializationEvent event) {
    blocks.init();
    items.init();
}
 
Example 15
Source File: NovaMinecraft.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
	Game.events().publish(new ServerEvent.Stop());
}
 
Example 16
Source File: MainMod.java    From bartworks with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void onServerStarted(FMLServerStartedEvent event) {
    MainMod.runOnPlayerJoined(ConfigHandler.classicMode, ConfigHandler.disableExtraGassesForEBF);
}
 
Example 17
Source File: MainMod.java    From bartworks with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
    RegisterServerCommands.registerAll(event);
}
 
Example 18
Source File: WailaNBT.java    From wailanbt with MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    config.modConfigurationDirectory = event.getModConfigurationDirectory();
}
 
Example 19
Source File: OmniOcular.java    From OmniOcular with Apache License 2.0 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
    proxy.registerNEI();
}
 
Example 20
Source File: LetsModReboot.java    From LetsModReboot with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
    LogHelper.info("Post Initialization Complete!");
}