mirror of https://github.com/FabricMC/yarn.git
Fix extractServerJar jar task to use the path found in versions.list.
This commit is contained in:
parent
1f0b4b7ebc
commit
50f4f74efa
22
build.gradle
22
build.gradle
|
@ -258,13 +258,27 @@ task extractServerJar(dependsOn: downloadMcJars) {
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
new ZipFile(serverBootstrapJar as File).withCloseable { zip ->
|
new ZipFile(serverBootstrapJar as File).withCloseable { zip ->
|
||||||
def entry = zip.getEntry("META-INF/versions/${minecraft_version}/server-${minecraft_version}.jar")
|
def serverVersionsEntry = zip.getEntry("META-INF/versions.list")
|
||||||
|
|
||||||
if (!entry) {
|
if (!serverVersionsEntry) {
|
||||||
throw new RuntimeException("Failed to find server jar entry: ")
|
throw new RuntimeException("Could not find versions.list")
|
||||||
}
|
}
|
||||||
|
|
||||||
zip.getInputStream(entry).withCloseable { is ->
|
def jarPath = null
|
||||||
|
|
||||||
|
zip.getInputStream(serverVersionsEntry).withCloseable { is ->
|
||||||
|
def versions = is.text.split("\t")
|
||||||
|
assert versions.length == 3
|
||||||
|
jarPath = versions[2]
|
||||||
|
}
|
||||||
|
|
||||||
|
def serverJarEntry = zip.getEntry("META-INF/versions/${jarPath}")
|
||||||
|
|
||||||
|
if (!serverJarEntry) {
|
||||||
|
throw new RuntimeException("Failed to find server jar entry ${jarPath}")
|
||||||
|
}
|
||||||
|
|
||||||
|
zip.getInputStream(serverJarEntry).withCloseable { is ->
|
||||||
serverJar.bytes = is.readAllBytes()
|
serverJar.bytes = is.readAllBytes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue