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

The following examples show how to use cpw.mods.fml.common.Mod#EventHandler . 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   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: OpenPeripheral   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 4
Source Project: qcraft-mod   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 5
Source Project: bartworks   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 6
Source Project: GardenCollection   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 7
@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
@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 9
Source Project: OmniOcular   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 10
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
    FMLCommonHandler.instance().bus().register(new KeyInputEventHandler());
    Recipes.init();
    LogHelper.info("Initialization Complete!");
}
 
Example 11
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event)
{
    LogHelper.info("Post Initialization Complete!");
}
 
Example 12
Source Project: OmniOcular   File: OmniOcular.java    License: Apache License 2.0 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
    proxy.registerNEI();
}
 
Example 13
Source Project: wailanbt   File: WailaNBT.java    License: MIT License 4 votes vote down vote up
@SideOnly(Side.CLIENT)
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    config.modConfigurationDirectory = event.getModConfigurationDirectory();
}
 
Example 14
Source Project: bartworks   File: MainMod.java    License: MIT License 4 votes vote down vote up
@Mod.EventHandler
public void onServerStarting(FMLServerStartingEvent event) {
    RegisterServerCommands.registerAll(event);
}
 
Example 15
Source Project: bartworks   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 16
@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 17
@Mod.EventHandler
public void serverStopping(FMLServerStoppingEvent event) {
	Game.events().publish(new ServerEvent.Stop());
}
 
Example 18
Source Project: GardenCollection   File: GardenStuff.java    License: MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit (FMLPreInitializationEvent event) {
    blocks.init();
    items.init();
}
 
Example 19
@Mod.EventHandler
public void serverLoad(FMLServerStartingEvent event) {
    IMP.insertCommands();
}
 
Example 20
Source Project: OpenPeripheral   File: OpenPeripheralCore.java    License: 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();
}