Fix for 1.18-pre1 server bundler.

In the bundler its called 1.18 Pre-release 1 not 1.18-pre1, so we just assume there is only ever going to be 1 version per jar.
This commit is contained in:
modmuss50 2021-11-11 18:28:15 +00:00
parent e2b4bc8985
commit 2994c2d488
2 changed files with 11 additions and 7 deletions

View file

@ -281,8 +281,13 @@ public class MinecraftProviderImpl extends DependencyProvider implements Minecra
}
String jarPath = null;
String[] versions = versionsList.split("\n");
for (String version : versionsList.split("\n")) {
if (versions.length != 1) {
throw new UnsupportedOperationException("Expected only 1 version in META-INF/versions.list, but got %d".formatted(versions.length));
}
for (String version : versions) {
if (version.isBlank()) continue;
String[] split = version.split("\t");
@ -293,10 +298,9 @@ public class MinecraftProviderImpl extends DependencyProvider implements Minecra
final String id = split[1];
final String path = split[2];
if (minecraftVersion().equals(id)) {
jarPath = path;
break;
}
// Take the first (only) version we find.
jarPath = path;
break;
}
Objects.requireNonNull(jarPath, "Could not find minecraft server jar for " + minecraftVersion());

View file

@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx1G
minecraft_version=21w44a
yarn_mappings=21w44a+build.8
minecraft_version=1.18-pre1
yarn_mappings=1.18-pre1+build.2
loader_version=0.12.5
fabric_version=0.42.1+1.18