Skip to content

Commit

Permalink
Add method to get Forge versions for specific Minecraft version (#5)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
GamerVII-NET authored Jul 7, 2024
1 parent 8c79ce9 commit 48e18b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CmlLib.Core.Installer.Forge/ForgeInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public async Task<string> Install(
return await Install(bestVersion, options);
}

public Task<IEnumerable<ForgeVersion>> GetForgeVersions(string mcVersion)
{
return _versionLoader.GetForgeVersions(mcVersion);
}

public Task<string> Install(string mcVersion, string forgeVersion) =>
Install(mcVersion, forgeVersion, new ForgeInstallOptions());

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

var version = await checkAndDownloadVanillaVersion(
forgeVersion.MinecraftVersionName,
options.FileProgress,
forgeVersion.MinecraftVersionName,
options.FileProgress,
options.ByteProgress);

if (string.IsNullOrEmpty(options.JavaPath))
Expand Down Expand Up @@ -105,6 +110,7 @@ private string getJavaPath(IVersion version)
javaPath = _launcher.GetDefaultJavaPath();
if (string.IsNullOrEmpty(javaPath) || !File.Exists(javaPath))
throw new InvalidOperationException("Cannot find any java binary. Set java binary path");

return javaPath;
}

Expand Down

0 comments on commit 48e18b8

Please sign in to comment.