Giter Site home page Giter Site logo

forge-installprocessor.net's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.