Skip to content

Commit 48e18b8

Browse files
authored
Add method to get Forge versions for specific Minecraft version (#5)
* Add method to get Forge versions for specific Minecraft version A new public method, `GetForgeVersions`, has been added to the `ForgeInstaller.cs` class. This method returns the available Forge versions for a specific Minecraft version, improving the process of version management and installation. * Disable ad display and update package references The ad display function `showAd()` in `ForgeInstaller.cs` has been commented out to disable showing of ads. In addition, a package reference for "CmlLib.Core" in `CmlLib.Core.Installer.Forge.csproj` was removed and a new project reference to "CmlLib.Core.csproj" was added. This change will ensure the use of the most recent and relevant references. * Revert "Disable ad display and update package references" This reverts commit 9040df8.
1 parent 8c79ce9 commit 48e18b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CmlLib.Core.Installer.Forge/ForgeInstaller.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public async Task<string> Install(
3838
return await Install(bestVersion, options);
3939
}
4040

41+
public Task<IEnumerable<ForgeVersion>> GetForgeVersions(string mcVersion)
42+
{
43+
return _versionLoader.GetForgeVersions(mcVersion);
44+
}
45+
4146
public Task<string> Install(string mcVersion, string forgeVersion) =>
4247
Install(mcVersion, forgeVersion, new ForgeInstallOptions());
4348

@@ -62,8 +67,8 @@ public async Task<string> Install(
6267
return installer.VersionName;
6368

6469
var version = await checkAndDownloadVanillaVersion(
65-
forgeVersion.MinecraftVersionName,
66-
options.FileProgress,
70+
forgeVersion.MinecraftVersionName,
71+
options.FileProgress,
6772
options.ByteProgress);
6873

6974
if (string.IsNullOrEmpty(options.JavaPath))
@@ -105,6 +110,7 @@ private string getJavaPath(IVersion version)
105110
javaPath = _launcher.GetDefaultJavaPath();
106111
if (string.IsNullOrEmpty(javaPath) || !File.Exists(javaPath))
107112
throw new InvalidOperationException("Cannot find any java binary. Set java binary path");
113+
108114
return javaPath;
109115
}
110116

0 commit comments

Comments
 (0)