Skip to content

TT702/Forge-InstallProcessor.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Forge-InstallProcessor.NET

C# Methods to Install Minecraft Forge 1.13+

简体中文

Requirement

.Net Framework 4.5 or Higher Due to using the System.IO.Compression.FileSystem.
You can modify the GetMainClassFromJar(); Method in Installer.Processor in order to running in .Net Framework 4.0(Yes!) or Lower(Maybe?).

Who need this?

If you want to Install Forge without showing the Forge Installer GUI, you can use this method to install Forge.
The Minecraft Launcher using this method: BakaXL - Minecraft Launcher

Minecraft Version Forge Version Supported?
Minecraft 1.12 or Below Forge 1.12.2 - 14.23.5.2847 or Below
Minecraft 1.13.2 or Higher Forge 1.13.2 - 25.0.160 or Higher ✔️

Usage

  1. Make Sure You Have the Original Minecraft JAR at <Your exe Path>/.minecraft/versions/<Minecraft Version>.
  2. Download Forge Installer from Forge Offical Website. (Here)
  3. Extract Installer (Using Code or Whatever).
  4. Use whatevere the method to Convert "install_profile.json" to Installer.Forge.InstallProfile Object (e.g LitJson).
    //Create InstallProfile Object
    var installProfile= new Forge.InstallProfile();
    using (var sr = new StreamReader("install_profile.json")) {
    		try {
    		    //Use LitJson to Convert Json String to Object.
    		    installProfile = JsonMapper.ToObject<Forge.InstallProfile>(sr.ReadToEnd());
                sr.Close();
    		} catch (Exception ex) {
    		    Trace.WriteLine("[Error]Failed while Read" + ex);
    		    throw ex;
    		}
    		if (installProfile == null) {
    		    Trace.WriteLine("[Error]Failed.");
    	    	sr.Close();
            }
    }
  5. Download all the nesseary libraries inside installProfile.libraries.
      5.1 Notice that there are two libraries already included in Forge Install Jar (e.g: Forge 1.15.2-31.1.0)
        "maven/net/minecraftforge/forge/1.15.2-31.1.0/forge-1.15.2-31.1.0.jar"
        "maven/net/minecraftforge/forge/1.15.2-31.1.0/forge-1.15.2-31.1.0-universal.jar"
        Copy these two file to ".minecraft/libraries/net/minecraftforge/forge/1.15.2-31.0.13" Folder.
  6. Create Installer.Processor Instance.
      var processor = new Installer.Processor();
      
      //Set the Log Status.
      processor.LogStatus = Installer.Processor.LogLevel.Verbose;
  7. Initialize Installer.Processor.
      if(processor.Init(Installer.Forge.InstallProfile, "Your Java.exe Path")) {
          //Begin Installation.
          processor.Begin();
      } else { 
          //Initialize Failed.
          //Do something here...
      }
  8. Done!

Log Status

Processor allows you to set different Log Level.

Log Level Description
None Output Nothing. World is Clean.
InstallOnly Output the Install Stage and Forge Installer's output.
Verbose Output Everything including generated Java Args. It's Annoying.

Modify

IProgress<Installer.InstallTask> is not necessary, it can let processor report current stage. You can remove it from the code if you want.

Notice

The Forge Will be installed at the <Your exe Path>/.minecraft/versions/<Forge Version>. You Need to Change the Namespace Manully Due to These Code Was Export From BakaXL Source Code.

See also

My friends are also doing some greate job on Installing Forge 1.13+. Please also have a look.

About

C# Classes to Install Minecraft Forge 1.13+

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages