Java Code Examples for cpw.mods.fml.common.event.FMLPreInitializationEvent#getModLog()

The following examples show how to use cpw.mods.fml.common.event.FMLPreInitializationEvent#getModLog() . 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: MyTown.java    From MyTown2 with The Unlicense 6 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent ev) {
    // Setup Loggers
    LOG = ev.getModLog();

    Constants.CONFIG_FOLDER = ev.getModConfigurationDirectory().getPath() + "/MyTown/";

    // Read Configs
    Config.instance.init(Constants.CONFIG_FOLDER + "/MyTown.cfg", Constants.MODID);
    LOCAL = new Local(Constants.CONFIG_FOLDER+"/localization/", Config.instance.localization.get(), "/mytown/localization/", MyTown.class);
    LocalManager.register(LOCAL, "mytown");

    registerHandlers();

    // Register ICrashCallable's
    FMLCommonHandler.instance().registerCrashCallable(new DatasourceCrashCallable());
}
 
Example 2
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 3
Source File: NEIIntegration.java    From NEI-Integration with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
    if (evt.getSide() != Side.CLIENT) {
        return;
    }
    
    log = evt.getModLog();
    log.info("Starting NEI Integration");
    
    integrations = Integrations.getIntegrations();
    Config.preInit(evt);
}
 
Example 4
Source File: SimplyJetpacks.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
@EventHandler
public static void preInit(FMLPreInitializationEvent evt) {
    logger = evt.getModLog();
    logger.info("Starting Simply Jetpacks");
    
    checkCoFHLib();
    
    Packs.preInit();
    Config.preInit(evt);
    ModItems.preInit();
}
 
Example 5
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
    MinecraftForge.TERRAIN_GEN_BUS.register(new MoCEventHooks()); // register our event subscriptions
    log = event.getModLog();
    // check if config exists, if not then copy default
    File mocConfigFile = new File(event.getSuggestedConfigurationFile().getParent() + File.separator + "MoCProperties.cfg");

    if (!mocConfigFile.exists())
    {
        log.info("could not find MoCProperties.cfg, copying defaults...");
        try {
            InputStream is = getClass().getResourceAsStream("/drzhark/mocreatures/resources/MoCProperties.cfg");
            OutputStream out = new FileOutputStream(mocConfigFile);
            int read = 0;
            byte[] bytes = new byte[1024];

            while ((read = is.read(bytes)) != -1) {
            out.write(bytes, 0, read);
            }

            is.close();
            out.flush();
            out.close();

            log.info("MoCPropeties.cfg has been created successfully!");
        } catch (IOException e) {
            log.warning("unable to create MoCProperties.cfg!!");
            e.printStackTrace();
        }
    }
    proxy.ConfigInit(event);
    proxy.initSounds();
}
 
Example 6
Source File: HexxitGear.java    From HexxitGear with GNU General Public License v3.0 5 votes vote down vote up
@PreInit
public void preInit(FMLPreInitializationEvent evt) {
    HexxitGearConfig.setConfigFolderBase(evt.getModConfigurationDirectory());

    HexxitGearConfig.loadCommonConfig(evt);

    HexxitGearConfig.extractLang(new String[]{"en_US"});
    HexxitGearConfig.loadLang();
    HexxitGearConfig.registerDimBlacklist();

    logger = evt.getModLog();
    playerEventHandler = new PlayerEventHandler();
    MinecraftForge.EVENT_BUS.register(playerEventHandler);
}
 
Example 7
Source File: Framez.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {

    log = event.getModLog();

    FramezAPI.setup(new FramezAPIImpl());

    ThreadBlockChecking.instance().start();

    CompatibilityUtils.preInit(event);

    /*
     * Register default movement handlers and data providers
     */

    FrameMovementRegistry.instance().registerMovementHandler(new MovementHandlerDefault());
    FrameMovementRegistry.instance().registerMovementHandler(new MovementHandlerFluid());
    MovementHandlerFMP fmpHandler = new MovementHandlerFMP();
    FrameMovementRegistry.instance().registerMovementHandler(fmpHandler);
    FrameMovementRegistry.instance().registerStickyProvider(fmpHandler);

    FrameMovementRegistry.instance().registerMovementDataProvider(new MovementDataProviderDefault());

    /*
     * Register frame modifiers
     */
    FrameModifierRegistry.instance().registerModifier(new FrameModifierSimple());

    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialWood());

    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialIron());
    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialCopper());
    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialTin());
    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialSilver());

    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialGold());

    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialBronze());
    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialInvar());

    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialElectrum());

    FrameModifierRegistry.instance().registerModifier(new FrameModifierMaterialEnderium());

    /*
     * Register frame side modifiers
     */

    FrameModifierRegistry.instance().registerModifier(new FrameSideModifierLatching());
}
 
Example 8
Source File: ArchimedesShipMod.java    From archimedes-ships with MIT License 4 votes vote down vote up
@EventHandler
public void preInitMod(FMLPreInitializationEvent event)
{
	modLog = event.getModLog();
	
	/*MaterialMap.registerMaterial("air", Material.air);
	MaterialMap.registerMaterial("anvil", Material.anvil);
	MaterialMap.registerMaterial("cactus", Material.cactus);
	MaterialMap.registerMaterial("cake", Material.cake);
	MaterialMap.registerMaterial("carpet", Material.carpet);
	MaterialMap.registerMaterial("circuits", Material.circuits);
	MaterialMap.registerMaterial("clay", Material.clay);
	MaterialMap.registerMaterial("cloth", Material.cloth);
	MaterialMap.registerMaterial("coral", Material.coral);
	MaterialMap.registerMaterial("dragon_egg", Material.dragonEgg);
	MaterialMap.registerMaterial("fire", Material.fire);
	MaterialMap.registerMaterial("glass", Material.glass);
	MaterialMap.registerMaterial("gourd", Material.gourd);
	MaterialMap.registerMaterial("grass", Material.grass);
	MaterialMap.registerMaterial("ground", Material.ground);
	MaterialMap.registerMaterial("ice", Material.ice);
	MaterialMap.registerMaterial("ice_packed", Material.packedIce);
	MaterialMap.registerMaterial("iron", Material.iron);
	MaterialMap.registerMaterial("lava", Material.lava);
	MaterialMap.registerMaterial("leaves", Material.leaves);
	MaterialMap.registerMaterial("piston", Material.piston);
	MaterialMap.registerMaterial("plants", Material.plants);
	MaterialMap.registerMaterial("portal", Material.portal);
	MaterialMap.registerMaterial("redstone_light", Material.redstoneLight);
	MaterialMap.registerMaterial("rock", Material.rock);
	MaterialMap.registerMaterial("sand", Material.sand);
	MaterialMap.registerMaterial("snow", Material.snow);
	MaterialMap.registerMaterial("snow_crafted", Material.craftedSnow);
	MaterialMap.registerMaterial("sponge", Material.sponge);
	MaterialMap.registerMaterial("tnt", Material.tnt);
	MaterialMap.registerMaterial("vine", Material.vine);
	MaterialMap.registerMaterial("water", Material.water);
	MaterialMap.registerMaterial("web", Material.web);
	MaterialMap.registerMaterial("wood", Material.wood);*/
	
	modConfig = new ArchimedesConfig(new Configuration(event.getSuggestedConfigurationFile()));
	modConfig.loadAndSave();
	
	metaRotations.setConfigDirectory(event.getModConfigurationDirectory());
	
	pipeline.initalize();
	
	createBlocksAndItems();
	
	modConfig.postLoad();
}