Java Code Examples for net.minecraftforge.fml.common.Mod

The following are top voted examples for showing how to use net.minecraftforge.fml.common.Mod. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ObsidianSuite   File: ObsidianAnimator.java   View source code 6 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{		
	FMLInterModComms.sendRuntimeMessage(MODID, "VersionChecker", "addVersionCheck", VERSION_LINK);
	
	instance = this;		
	proxy.init();
       
       EventHandler eventHandler = new EventHandler();
       MinecraftForge.EVENT_BUS.register(eventHandler);
	
       if(FMLCommonHandler.instance().getEffectiveSide().isClient())
           FMLCommonHandler.instance().bus().register(eventHandler);
       
       //Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
       Minecraft.getMinecraft().gameSettings.saveOptions();
       
       //Stop space from activating buttons, allowing it to be used for adding keyframes in the timeline.
       InputMap im = (InputMap)UIManager.get("Button.focusInputMap");
       im.put(KeyStroke.getKeyStroke("pressed SPACE"), "none");
       im.put(KeyStroke.getKeyStroke("released SPACE"), "none");
}
 
Example 2
Project: World-Border   File: WorldBorder.java   View source code 6 votes vote down vote up
@Mod.EventHandler
@SideOnly(Side.SERVER)
public void serverStart(FMLServerStartingEvent event)
{
    if (INSTANCE == null) INSTANCE = this;
    if (SERVER   == null) SERVER   = event.getServer();
    if (COMMAND  == null) COMMAND  = new WBCommand();

    // Load (or create new) config files
    Config.load(false);

    // our one real command, though it does also have aliases "wb" and "worldborder"
    event.registerServerCommand(COMMAND);

    if ( Config.preventBlockPlace() )
        enableBlockPlaceListener(true);

    if ( Config.preventMobSpawn() )
        enableMobSpawnListener(true);

    if ( Config.getDenyEnderpearl() )
        enableEnderPearlListener(true);

    DynMapFeatures.registerListener();
}
 
Example 3
Project: AuthlibLoginHelper   File: AuthlibLoginHelper.java   View source code 6 votes vote down vote up
@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent event)
{
    try
    {
        instance = this;
        this.logger = event.getModLog();
        this.conf = new File(Launch.minecraftHome, "authlibloginhelper-accounts.json");
        if (this.conf.createNewFile())
        {
            String path = this.conf.getAbsolutePath();
            this.logger.info("AuthlibLoginHelper: Successfully created " + path);
        }
        MinecraftForge.EVENT_BUS.register(this);
    }
    catch (IOException e)
    {
        throw Throwables.propagate(e);
    }
}
 
Example 4
Project: UHC-Compass   File: UHCCompass.java   View source code 6 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
    config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();
    COMPASSX_PROPERTY = config.get("hidden", ConfigValues.COMPASSX_NAME, ConfigValues.COMPASSX_DEFAULT, I18n.format(ConfigValues.COMPASSX_NAME+".tooltip"));
    COMPASSY_PROPERTY = config.get("hidden", ConfigValues.COMPASSY_NAME, ConfigValues.COMPASSY_DEFAULT, I18n.format(ConfigValues.COMPASSY_NAME+".tooltip"));
    TARGETX_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETX_NAME, ConfigValues.TARGETX_DEFAULT, I18n.format(ConfigValues.TARGETX_NAME+".tooltip"));
    TARGETZ_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETZ_NAME, ConfigValues.TARGETZ_DEFAULT, I18n.format(ConfigValues.TARGETZ_NAME+".tooltip"));
    XALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.XALIGNMENT_NAME, ConfigValues.XALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.XALIGNMENT_NAME+".tooltip"));
    YALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.YALIGNMENT_NAME, ConfigValues.YALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.YALIGNMENT_NAME+".tooltip"));
    syncConfig();

    GameRegistry.register(uhccompass);
    ModelLoader.setCustomModelResourceLocation(uhccompass, 0, new ModelResourceLocation(MODID+":uhccompass", "inventory"));

    MinecraftForge.EVENT_BUS.register(new ClientEvents());
    MinecraftForge.EVENT_BUS.register(new RenderEvents());
    MinecraftForge.EVENT_BUS.register(keyHandler = new KeyHandler());
}
 
Example 5
Project: Mods   File: TF2weapons.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void postinit(FMLPostInitializationEvent event) {

	updateMobSpawning();
	updateOreGenStatus();
	
	animals = new ArrayList<>();
	for(ResourceLocation entry:ForgeRegistries.ENTITIES.getKeys()) {
		if(EntityAnimal.class.isAssignableFrom(EntityList.getClass(entry))) {
			animals.add(entry);
		}
	}
}
 
Example 6
Project: KubidibotsStreamDownloaderFromYoutubeAndDisplayerThanksToAForgeMod   File: Streamer.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    logger = event.getModLog();
}
 
Example 7
Project: RecipeManipulator   File: RecipeManipulator.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
	try {
		removeRecipes();
	} catch (IOException e) {
		e.printStackTrace();
	}
	readDirectory(recipeDir);
}
 
Example 8
Project: Industrial-Foregoing   File: IndustrialForegoing.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void construction(FMLConstructionEvent event) {
    Arrays.asList(TeslaCoreLibConfig.REGISTER_MACHINE_CASE, TeslaCoreLibConfig.REGISTER_GEARS,
            TeslaCoreLibConfig.REGISTER_GEAR_TYPES + "#" + CoreGearType.IRON.getMaterial(),
            TeslaCoreLibConfig.REGISTER_GEAR_TYPES + "#" + CoreGearType.GOLD.getMaterial(),
            TeslaCoreLibConfig.REGISTER_GEAR_TYPES + "#" + CoreGearType.DIAMOND.getMaterial(),
            TeslaCoreLibConfig.REGISTER_ADDONS,
            TeslaCoreLibConfig.REGISTER_SPEED_ADDONS,
            TeslaCoreLibConfig.REGISTER_ENERGY_ADDONS).forEach(s -> TeslaCoreLibConfig.INSTANCE.setDefaultFlag(s, true));
    TeslaCoreLibConfig.INSTANCE.setDefaultFlag(TeslaCoreLibConfig.ALLOW_ENERGY_DISPLAY_CHANGE, false);
}
 
Example 9
Project: World-Border   File: WorldBorder.java   View source code 5 votes vote down vote up
/**
 * Given WorldBorder's dependency on dedicated server classes and is designed for
 * use in multiplayer environments, we don't load anything on the client
 */
@Mod.EventHandler
@SideOnly(Side.CLIENT)
public void clientPreInit(FMLPreInitializationEvent event)
{
    Log.error("This mod is intended only for use on servers");
    Log.error("Please consider removing this mod from your installation");
}
 
Example 10
Project: Mods   File: TF2weapons.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void serverPreInit(FMLServerAboutToStartEvent event) {
	// System.out.println("Starting server");
	
	if (!event.getServer().isDedicatedServer())
		for (WeaponData weapon : MapList.nameToData.values())
			ClientProxy.RegisterWeaponData(weapon);
	
	/*if(event.getSide()==Side.SERVER)
		AchievementPage.registerAchievementPage(new TF2Achievements());*/
}
 
Example 11
Project: harshencastle   File: HarshenCastle.java   View source code 5 votes vote down vote up
@Mod.EventHandler
  public void postInit(FMLPostInitializationEvent event) 
  {
  	proxy.postInit(event);
hasLoaded = true;

  }
 
Example 12
Project: FirstAid   File: FirstAid.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void onServerStop(FMLServerStoppedEvent event) {
    logger.debug("Cleaning up");
    PlayerDataManager.capList.clear();
    PlayerDataManager.tutorialDone.clear();
    EventHandler.hitList.clear();
}
 
Example 13
Project: CreeperHostGui   File: CreeperHostServer.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    if (!CreeperHost.instance.active)
        return;
    event.registerServerCommand(new CommandInvite());
    event.registerServerCommand(new CommandPregen());
    deserializePreload(new File(getSaveFolder(), "pregenData.json"));
}
 
Example 14
Project: CreeperHostGui   File: CreeperHostServer.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e)
{
    if (!CreeperHost.instance.active)
        return;
    MinecraftForge.EVENT_BUS.register(this);
    logger = e.getModLog();
    setupPlayerKicker();
}
 
Example 15
Project: MeeCreeps   File: MeeCreeps.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void imcCallback(FMLInterModComms.IMCEvent event) {
    for (FMLInterModComms.IMCMessage message : event.getMessages()) {
        if (message.key.equalsIgnoreCase("getMeeCreepsApi")) {
            Optional<Function<IMeeCreepsApi, Void>> value = message.getFunctionValue(IMeeCreepsApi.class, Void.class);
            if (value.isPresent()) {
                value.get().apply(api);
            } else {
                logger.warn("Some mod didn't return a valid result with getMeeCreepsApi!");
            }
        }
    }
}
 
Example 16
Project: signal-catcher   File: SignalCatcher.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    // Don't run client-side, it makes kill not kill the whole client.
    if (event.getSide() != Side.SERVER) return;
    sig("TERM");
    sig("INT");
    sig("HUP");
}
 
Example 17
Project: PurificatiMagicae   File: PurMag.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e)
{
    config.setupInit(configFile);
    getSipEffects().register();
    ItemRegistry.setupOreDict();
    getIfRegistry().setup();
    NetworkManager.setup();
    WorldgenRegistry.setup();
    LootTablesRegistry.setup();
    MultiblockRegistry.setup();

    proxy.init();
}
 
Example 18
Project: AuthMod   File: Main.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
	System.out.println(name + " is loading!");
       config.put("logout", "1");
       config.put("rmlogin", "1");
       config.put("see", "1");
       config.put("unregister", "1");
       config.put("changelogin", "1");
       config.put("allowtp", "0");
       config.put("nochat", "1");
       config.put("timeout", "60");
       config.put("iplogin", "0");
       
       config.put("wrongpass", "Wrong password.");
       config.put("loginmessage", "Please use /login <password>");
       config.put("iploginmessage", "Sucessfully logged by IP !");
       config.put("registermessage", "Please use /register <password>");
       config.put("notloggedin", "Not logged in.");
       config.put("disconnectedmessage", "Sucessfully disconnected !");
       config.put("loggedmessage", "Sucessfully logged in !");
       config.put("registeredmessage", "Sucessfully registered !");
       config.put("allreadyregistered", "Allready registered !");
       config.put("accountdeleted", "Account deleted !");
       config.put("accountnoexist", "Account does not exist !");
       config.put("passwordchanged", "Password changed !");
       config.put("timeouttext", "Too long to login !");
       config.put("debug", "0");
       config.put("fakeplayer", "1");
       config.put("fakenames","[Mekanism],[XU2FakePlayer]");
	}
 
Example 19
Project: HardcoreRevival   File: HardcoreRevival.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
	if(event.getSide() == Side.CLIENT && ModConfig.teamUpIntegration) {
		event.buildSoftDependProxy("teamup", "net.blay09.mods.hardcorerevival.compat.TeamUpAddon");
	}

	if(event.getSide() == Side.CLIENT && ModConfig.pingIntegration) {
		event.buildSoftDependProxy("ping", "net.blay09.mods.hardcorerevival.compat.PingAddon");
	}
}
 
Example 20
Project: Clef   File: Clef.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    resourceHelper = new ResourceHelper(new File(event.getModConfigurationDirectory().getParent(), "/mods/clef"));

    config = ConfigHandler.registerConfig(new Config(event.getSuggestedConfigurationFile()));

    proxy.preInitMod();

    UpdateChecker.registerMod(new UpdateChecker.ModVersionInfo(MOD_NAME, iChunUtil.VERSION_OF_MC, VERSION, false));
}
 
Example 21
Project: CraftTweaker-Advancements   File: CRTADV.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void onFMLServerStarted(FMLServerStartedEvent event) {

	for (WorldServer world : FMLCommonHandler.instance().getMinecraftServerInstance().worlds) {
		
		log.info("Wrapping advancement manager for {}", getWorldName(world));
		world.advancementManager = new AdvancementManagerWrapper(world.advancementManager);
	}
}
 
Example 22
Project: Randores2   File: Randores.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void onPostInit(FMLPostInitializationEvent ev) {
    info("Randores is PostInitializing...");
    info("Calling proxy PostInitialization...");
    Randores.PROXY.postInitSided(ev);
    info("Finished PostInitialization.");
}
 
Example 23
Project: interactionwheel   File: InteractionWheel.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void imcCallback(FMLInterModComms.IMCEvent event) {
    for (FMLInterModComms.IMCMessage message : event.getMessages()) {
        if (message.key.equalsIgnoreCase("getTheWheel")) {
            Optional<Function<IInteractionWheel, Void>> value = message.getFunctionValue(IInteractionWheel.class, Void.class);
            if (value.isPresent()) {
                value.get().apply(interactionWheelImp);
            } else {
                logger.warn("Some mod didn't return a valid result with getTheWheel!");
            }
        }
    }
}
 
Example 24
Project: statclock   File: Statclock.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    TabStatclock = new CreativeTabSC(CreativeTabs.getNextID(), "tab_statclock");

    ModItems.preInit();
    ModBlocks.preInit();

    GameRegistry.registerWorldGenerator(new Generation(), 2);
    proxy.preInit(event);

}
 
Example 25
Project: customstuff4   File: CustomStuff4.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    MinecraftForge.EVENT_BUS.register(EventHandler.class);

    initPlugins(event.getAsmData());

    File configDir = event.getModConfigurationDirectory();
    File modsDir = new File(configDir.getParent(), "mods");

    registerPackets();

    NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
    ModLoader.initMods(modsDir);
}
 
Example 26
Project: Simple-Chunks   File: SimpleChunks.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	logger = event.getModLog();

	proxy.preInit(event);
}
 
Example 27
Project: morefurnaces   File: MoreFurnaces.java   View source code 5 votes vote down vote up
@Mod.EventHandler
public void load(FMLInitializationEvent evt)
{
    for (FurnaceType typ : FurnaceType.values())
    {
        GameRegistry.registerTileEntity(typ.clazz, "CubeX2 " + typ.friendlyName);
    }

    NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
}
 
Example 28
Project: chunk-logger   File: ChunkLogger.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
	proxy.init(event);
	
}
 
Example 29
Project: Sound-Physics   File: SoundPhysicsCore.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
	FMLCommonHandler.instance().bus().register(instance);
}
 
Example 30
Project: tp-plus   File: TPPlus.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){ }
 
Example 31
Project: Lanolin   File: Lanolin.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
    proxy.init(e);
}
 
Example 32
Project: Lanolin   File: Lanolin.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent e) {
    proxy.postInit(e);
}
 
Example 33
Project: modName   File: ExampleMod.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e)
{
    proxy.init(e);
}
 
Example 34
Project: TechReborn3   File: TechReborn.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void serverStarting(FMLServerStartingEvent event) {
	event.registerServerCommand(new CommandTechRebornTest());
}
 
Example 35
Project: Anima-Mundi   File: Anima.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void OnPreInit(FMLPreInitializationEvent event)
{
	Proxy.OnPreInit(event);
}
 
Example 36
Project: ProgressiveDifficulty   File: ProgressiveDifficulty.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
    proxy.preInit(event);
}
 
Example 37
Project: ProgressiveDifficulty   File: ProgressiveDifficulty.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent event)
{
    proxy.init(event);
}
 
Example 38
Project: ProgressiveDifficulty   File: ProgressiveDifficulty.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event){
    proxy.postInit(event);
}
 
Example 39
Project: genera   File: Genera.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
    logger = event.getModLog();
    proxy.preInit(event);
}
 
Example 40
Project: genera   File: Genera.java   View source code 4 votes vote down vote up
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
    proxy.init(e);
}