Java Code Examples for net.minecraftforge.fml.common.event.FMLPreInitializationEvent#getSuggestedConfigurationFile()

The following examples show how to use net.minecraftforge.fml.common.event.FMLPreInitializationEvent#getSuggestedConfigurationFile() . 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: WearableBackpacks.java    From WearableBackpacks with MIT License 5 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	LOG = event.getModLog();
	CHANNEL = new BackpacksChannel();
	
	CONFIG = new BackpacksConfig(event.getSuggestedConfigurationFile());
	CONFIG.load();
	CONFIG.save();
	
	CONTENT = new BackpacksContent();
	CONTENT.registerRecipes();
	
	PROXY.preInit();
}
 
Example 2
Source File: HoloInventory.java    From HoloInventory with MIT License 5 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();

    config = new Configuration(event.getSuggestedConfigurationFile());
    updateConfig();

    int id = 0;
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);

    // Request packets (client -> server)
    snw.registerMessage(EntityRequest.Handler.class, EntityRequest.class, id++, Side.SERVER);
    snw.registerMessage(TileRequest.Handler.class, TileRequest.class, id++, Side.SERVER);

    // Response packets (server -> client)
    snw.registerMessage(PlainInventory.Handler.class, PlainInventory.class, id++, Side.CLIENT);
    snw.registerMessage(MerchantRecipes.Handler.class, MerchantRecipes.class, id++, Side.CLIENT);

    if (event.getSide().isClient())
    {
        //noinspection MethodCallSideOnly
        ClientEventHandler.init();
    }

    MinecraftForge.EVENT_BUS.register(this);
    MinecraftForge.EVENT_BUS.register(ServerEventHandler.I);
}
 
Example 3
Source File: SkyblockAddons.java    From SkyblockAddons with MIT License 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
    configValues = new ConfigValues(this, e.getSuggestedConfigurationFile());
    persistentValues = new PersistentValues(e.getModConfigurationDirectory());
}
 
Example 4
Source File: SoundPhysicsCore.java    From Sound-Physics with GNU General Public License v3.0 4 votes vote down vote up
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	configFile = new Configuration(event.getSuggestedConfigurationFile());
	syncConfig();
}
 
Example 5
Source File: ConfigHandler.java    From VersionChecker with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void init(FMLPreInitializationEvent event)
{
    FMLCommonHandler.instance().bus().register(new ConfigHandler());
    configFile = new Configuration(event.getSuggestedConfigurationFile());
    syncConfig();
}
 
Example 6
Source File: Config.java    From CraftingKeys with MIT License 3 votes vote down vote up
/**
 * Initializes the configFile Files, loads all values (or sets them to default).
 *
 * @param event PreInitEvent from Main Class
 */
public static void loadConfig(FMLPreInitializationEvent event) {

    configFile = new Configuration(event.getSuggestedConfigurationFile(), CraftingKeys.VERSION);

    configFile.load();

    genComments();

    syncConfig();

}
 
Example 7
Source File: OpenMods.java    From OpenModsLib with MIT License 3 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
	new TypeVariableHolderHandler().fillAllHolders(evt.getAsmData());

	SyncChannelHolder.ensureLoaded();

	final File configFile = evt.getSuggestedConfigurationFile();
	Configuration config = new Configuration(configFile);
	ConfigProcessing.processAnnotations(MODID, config, LibConfig.class);
	MinecraftForge.EVENT_BUS.register(new ConfigChangeListener(MODID, config));

	if (config.hasChanged()) config.save();

	MinecraftForge.EVENT_BUS.register(DelayedEntityLoadManager.instance);

	MinecraftForge.EVENT_BUS.register(FakePlayerPool.instance);

	MinecraftForge.EVENT_BUS.register(DropCapture.instance);

	MinecraftForge.EVENT_BUS.register(DelayedActionTickHandler.INSTANCE);

	MinecraftForge.EVENT_BUS.register(ConfigStorage.instance);

	collector = new ClassSourceCollector(evt.getAsmData());

	ItemTextureCapability.register();

	final CompoundDataFixer dataFixer = FMLCommonHandler.instance().getDataFixer();

	EntityRegistry.registerModEntity(OpenMods.location("block"), EntityBlock.class, "Block", ENTITY_BLOCK_ID, instance, 64, 1, true);
	EntityBlock.registerFixes(dataFixer, EntityBlock.class);
	proxy.preInit();
}