Skip to content

Commit a1c7e9b

Browse files
Add NeoForge Installer documentation and examples (#5)
* Add NeoForge Installer documentation and examples - Introduced a comprehensive NeoForge Installer guide with setup instructions, supported versions, and usage examples. - Added English and Korean documentation, including README, getting-started, API references, and supported version lists. - Updated `SUMMARY.md` in both languages to incorporate NeoForge documentation. * Remove NeoForge Installer documentation - Deleted NeoForge Installer-related documentation files, including README, getting-started, API reference, and supported versions. - Updated `SUMMARY.md` to remove NeoForge documentation entries. * Simplify NeoForge Installer documentation by removing API reference section. * Update NeoForge Installer documentation - Corrected link to supported versions in the README. - Fixed references to `NeoForgeInstallOptions` and `neoForgeInstaller.Install` for clarity and consistency. --------- Co-authored-by: gamervii <terentev.a.a@recloud.tech>
1 parent 69f7a84 commit a1c7e9b

File tree

6 files changed

+216
-0
lines changed

6 files changed

+216
-0
lines changed

en/SUMMARY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,8 @@
6969
* [Supported Versions](installer.forge/supported-versions.md)
7070
* [Getting Started](installer.forge/getting-started.md)
7171
* [ForgeInstaller](installer.forge/forgeinstaller.md)
72+
* [🦊 Installer.NeoForge](installer.neoforge/README.md)
73+
* [Home](installer.neoforge/README.md)
74+
* [Supported Versions](installer.neoforge/supported-versions.md)
75+
* [Getting Started](installer.neoforge/getting-started.md)
76+
* [NeoForgeInstaller](installer.neoforge/neoforgeinstaller.md)

en/installer.neoforge/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Home
2+
3+
[GitHub](https://github.com/Gml-Launcher/CmlLib.Core.Installer.NeoForge)
4+
5+
NeoForge Installer for [CmlLib.Core](../cmllib.core/README.md).
6+
7+
## Features
8+
* Neoforge Developer Support! After successfully installing the Neoforge version, the Neoforge advertising page will automatically open for you.
9+
* Automatic change of links to install Neoforge
10+
* Automatic installation of the Vanilla version of Minecraft before installing Neoforge
11+
* Skipping the Neoforge re-installation
12+
13+
## Supported Neoforge Versions
14+
15+
**1.20.2 ~ 1.21.10** Neoforge versions was successfully tested. [All test results](supported-versions.md)
16+
17+
## LLM
18+
19+
[llms.txt](https://cmllib.github.io/CmlLib.Core-wiki/en/llms.txt) is provided.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Getting Started
2+
3+
## Install
4+
5+
Install nuget package [CmlLib.Core.Installer.NeoForge](https://www.nuget.org/packages/CmlLib.Core.Installer.NeoForge)
6+
7+
```
8+
dotnet add package CmlLib.Core.Installer.NeoForge
9+
```
10+
11+
## Example
12+
13+
```csharp
14+
using CmlLib.Core;
15+
using CmlLib.Core.Auth;
16+
using CmlLib.Core.Installer.NeoForge;
17+
using CmlLib.Core.Installer.NeoForge.Installers;
18+
using CmlLib.Core.Installers;
19+
using CmlLib.Core.ProcessBuilder;
20+
21+
var path = new MinecraftPath(); // use default directory
22+
var launcher = new MinecraftLauncher(path);
23+
24+
// show launch progress to console
25+
var fileProgress = new SyncProgress<InstallerProgressChangedEventArgs>(e =>
26+
Console.WriteLine($"[{e.EventType}][{e.ProgressedTasks}/{e.TotalTasks}] {e.Name}"));
27+
var byteProgress = new SyncProgress<ByteProgress>(e =>
28+
Console.WriteLine(e.ToRatio() * 100 + "%"));
29+
var installerOutput = new SyncProgress<string>(e =>
30+
Console.WriteLine(e));
31+
32+
//Initialize variables with the Minecraft version and the Forge version
33+
var mcVersion = "1.21.10";
34+
var forgeVersion = "21.10.2-beta";
35+
36+
//Initialize MForge
37+
var forge = new NeoForgeInstaller(launcher);
38+
39+
var version_name = await forge.Install(mcVersion, forgeVersion, new NeoForgeInstallOptions
40+
{
41+
FileProgress = fileProgress,
42+
ByteProgress = byteProgress,
43+
InstallerOutput = installerOutput,
44+
});
45+
46+
//Start Minecraft
47+
var launchOption = new MLaunchOption
48+
{
49+
MaximumRamMb = 1024,
50+
Session = MSession.CreateOfflineSession("GamerVII"),
51+
};
52+
53+
var process = await launcher.CreateProcessAsync(version_name, launchOption);
54+
55+
// print game logs
56+
var processUtil = new ProcessWrapper(process);
57+
processUtil.OutputReceived += (s, e) => Console.WriteLine(e);
58+
processUtil.StartWithEvents();
59+
await processUtil.WaitForExitTaskAsync();
60+
```
61+
62+
## Sample Installer
63+
64+
[SampleForgeInstaller](https://github.com/Gml-Launcher/CmlLib.Core.Installer.NeoForge/blob/master/SampleNeoForgeInstaller/Program.cs)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# NeoForgeInstaller
2+
3+
NeoForgeInstaller provides functionality to download and install NeoForge versions for Minecraft.
4+
5+
## Initializing the Installer
6+
7+
```csharp
8+
var path = new MinecraftPath();
9+
var launcher = new MinecraftLauncher(path);
10+
var neoForgeInstaller = new NeoForgeInstaller(launcher);
11+
```
12+
13+
Optionally, you can configure the HttpClient used to access the NeoForge website by using `new NeoForgeInstaller(launcher, new HttpClient())`.
14+
15+
## Listing Available Versions
16+
17+
```csharp
18+
var versions = await neoForgeInstaller.GetForgeVersions("1.21.10");
19+
foreach (var version in versions)
20+
{
21+
Console.WriteLine();
22+
Console.WriteLine("MinecraftVersion: " + version.MinecraftVersion);
23+
Console.WriteLine("VersionName: " + version.VersionName);
24+
25+
var installerFile = version.GetInstallerFile();
26+
if (installerFile != null)
27+
{
28+
Console.WriteLine("DirectUrl: " + installerFile.DirectUrl);
29+
}
30+
}
31+
```
32+
33+
This retrieves all available NeoForge versions that can be installed for the specified Minecraft version.
34+
35+
## Installation
36+
37+
### Installing the Best Version
38+
39+
```csharp
40+
var installedVersionName = await neoForgeInstaller.Install("1.21.10", new NeoForgeInstallOptions());
41+
```
42+
43+
This finds and installs the most appropriate NeoForge version available for Minecraft 1.21.10.
44+
45+
The appropriate version is selected using the following priority rules:
46+
47+
1. First version with the 'Recommended Version' flag
48+
2. First version with the 'Latest Version' flag
49+
3. The topmost version in the version list
50+
51+
### Installing a Specific Version
52+
53+
```csharp
54+
var installedVersionName = await neoForgeInstaller.Install("1.21.10", "21.10.56-beta", new NeoForgeInstallOptions());
55+
```
56+
57+
This installs NeoForge version 21.10.56-beta for Minecraft 1.21.10.
58+
59+
### Installing the Latest Version
60+
61+
```csharp
62+
var versions = await neoForgeInstaller.GetForgeVersions("1.21.10");
63+
var latestVersion = versions.First();
64+
var installedVersionName = await neoForgeInstaller.Install(latestVersion, new NeoForgeInstallOptions());
65+
```
66+
67+
This finds and installs the latest NeoForge version available for Minecraft 1.21.10.
68+
69+
## Installation Options
70+
71+
To use features like installation progress display and cancellation, configure the appropriate values in `NeoForgeInstallOptions`.
72+
73+
```csharp
74+
var installOptions = new NeoForgeInstallOptions
75+
{
76+
FileProgress = new Progress<InstallerProgressChangedEventArgs>(e =>
77+
Console.WriteLine($"[{e.EventType}][{e.ProgressedTasks}/{e.TotalTasks}] {e.Name}")),
78+
ByteProgress = new Progress<ByteProgress>(e =>
79+
Console.WriteLine(e.ToRatio() * 100 + "%")),
80+
InstallerOutput = new Progress<string>(e =>
81+
Console.WriteLine(e)),
82+
CancellationToken = CancellationToken.None,
83+
84+
JavaPath = "java.exe",
85+
SkipIfAlreadyInstalled = true,
86+
};
87+
var installedVersionName = await neoForgeInstaller.Install("1.21.10", installOptions);
88+
```
89+
90+
- **FileProgress** and **ByteProgress**: Report file download progress. See [Event Handling](../cmllib.core/getting-started/Handling-Events.md) for more details.
91+
- **InstallerOutput**: Reports logs output from the installer's console.
92+
- **CancellationToken**: Allows you to cancel the installation process.
93+
- **JavaPath**: Sets the path to the Java runtime used to execute the installer. The default value is `null`, which automatically determines the Java runtime path.
94+
- **SkipIfAlreadyInstalled**: When set to `true`, skips installation if the target version is already installed. The default value is `true`.
95+
96+
## Important Note About Complete Installation
97+
98+
`neoForgeInstaller.Install` does not fully install the NeoForge version. The version still needs additional files such as sound assets, Java runtime, and vanilla version files. Therefore, you should always call `launcher.InstallAsync` before launching the game.
99+
100+
```csharp
101+
// Install NeoForge
102+
var versionName = await neoForgeInstaller.Install("1.21.10", new NeoForgeInstallOptions());
103+
104+
// Install remaining dependencies (sound assets, Java runtime, vanilla version)
105+
await launcher.InstallAsync(versionName);
106+
107+
// Launch the game
108+
var process = await launcher.BuildProcessAsync(versionName, new MLaunchOption
109+
{
110+
MaximumRamMb = 1024,
111+
Session = MSession.CreateOfflineSession("GamerVII"),
112+
});
113+
process.Start();
114+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Supported Versions
2+
3+
This library supports NeoForge installations starting from version 1.20.2.
4+
All versions up to 1.21.10 have been fully tested and confirmed to work without issues.
5+
Versions after 1.21.10 are also supported — they have not been tested yet, but are expected to work normally.
6+
If you encounter any problems, please open an issue.
7+
8+
## Summary
9+
10+
| Range | Summary |
11+
|---------------------------------|----------------------------------------|
12+
| 1.20.2 ~ 1.21.10 | ✅ SUPPORT, tested |
13+
| after 1.21.10 ~ future versions | ✅ SUPPORT, not tested, but should work |

ko/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@
6969
* [시작하기](installer.forge/getting-started.md)
7070
* [ForgeInstaller](installer.forge/forgeinstaller.md)
7171
* [[AD] 커스텀 런처 주문제작](ad.md)
72+

0 commit comments

Comments
 (0)