Skip to content

Commit

Permalink
auto-cf: support three-part modloader IDs (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg authored Sep 27, 2024
1 parent 369e035 commit de570e6
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,24 +941,28 @@ private boolean isServerMod(CurseForgeFile file) {
private void prepareModLoader(String id, String minecraftVersion) {
log.debug("Preparing mod loader given id={} minecraftVersion={}", id, minecraftVersion);

final String[] parts = id.split("-", 2);
if (parts.length != 2) {
// id could be values like
// neoforge-1.20.1-47.1.99
final String[] parts = id.split("-", 3);
if (parts.length < 2) {
throw new GenericException("Unknown modloader ID: " + id);
}

final String loaderVersion = parts.length == 2 ? parts[1] : parts[2];

try (SharedFetch sharedFetch = Fetch.sharedFetch("install-curseforge", sharedFetchOptions)) {

switch (parts[0]) {
case "forge":
prepareForge(sharedFetch, minecraftVersion, parts[1]);
prepareForge(sharedFetch, minecraftVersion, loaderVersion);
break;

case "neoforge":
prepareNeoForge(sharedFetch, minecraftVersion, parts[1]);
prepareNeoForge(sharedFetch, minecraftVersion, loaderVersion);
break;

case "fabric":
prepareFabric(minecraftVersion, parts[1]);
prepareFabric(minecraftVersion, loaderVersion);
break;

default:
Expand Down

0 comments on commit de570e6

Please sign in to comment.