improve error handling
This commit is contained in:
parent
0234a3b49a
commit
b90330917c
|
@ -17,7 +17,7 @@ fun Project.minecraft(
|
||||||
): Project { // return self to allow for chaining
|
): Project { // return self to allow for chaining
|
||||||
if (VersionChecker.validateVersion(version)) {
|
if (VersionChecker.validateVersion(version)) {
|
||||||
println("Setting up Minecraft...")
|
println("Setting up Minecraft...")
|
||||||
val parchment = parchmentVersion?:ParchmentProvider.findForMinecraftVersion(version)
|
val parchment = parchmentVersion?: kotlin.runCatching { ParchmentProvider.findForMinecraftVersion(version) }.getOrDefault("")
|
||||||
PhytotelmaPlugin.minecraftVersion = version
|
PhytotelmaPlugin.minecraftVersion = version
|
||||||
PhytotelmaPlugin.parchmentVersion = parchment
|
PhytotelmaPlugin.parchmentVersion = parchment
|
||||||
println("Valid version! $version")
|
println("Valid version! $version")
|
||||||
|
@ -28,12 +28,22 @@ fun Project.minecraft(
|
||||||
val applyAW = AccessWidener.needsUpdate(this)
|
val applyAW = AccessWidener.needsUpdate(this)
|
||||||
if (remappedJar.notExists() || applyAW) {
|
if (remappedJar.notExists() || applyAW) {
|
||||||
println("Remapping the game...")
|
println("Remapping the game...")
|
||||||
val data = ProguardParser.read(MojmapProvider.get(version, clientJar.resolveSibling("client-$version.txt")).orElseThrow()).reverse()
|
val data = kotlin.runCatching { ProguardParser.read(MojmapProvider.get(version, clientJar.resolveSibling("client-$version.txt")).orElseThrow()).reverse() }.getOrNull()
|
||||||
val paramMappings = ParchmentProvider.getParchment(
|
val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching { ParchmentProvider.getParchment(
|
||||||
version, parchment,
|
version, parchment,
|
||||||
PhytotelmaPlugin.nonsenseCacheDir.resolve("org/parchmentmc/parchment/$version/$parchment")
|
PhytotelmaPlugin.nonsenseCacheDir.resolve("org/parchmentmc/parchment/$version/$parchment"))
|
||||||
)
|
}.getOrNull() else {
|
||||||
|
println("Parameter mappings will not be present as no parchment version was found. It may be possible to declare it manually.")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
if (paramMappings == null && parchment.isNotEmpty()){
|
||||||
|
println("Parameter mappings will not be present as the version $parchmentVersion for minecraft version $version could not be found")
|
||||||
|
}
|
||||||
|
if (data != null) {
|
||||||
Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings)
|
Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings)
|
||||||
|
} else {
|
||||||
|
error("Failed to remap the game as no mojmap version was found for game version $version. Other mapping formats may be implemented in the future.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
println("Adding dependencies...")
|
println("Adding dependencies...")
|
||||||
dependencies.add("implementation","net.minecrell:terminalconsoleappender:1.2.0")
|
dependencies.add("implementation","net.minecrell:terminalconsoleappender:1.2.0")
|
||||||
|
|
Loading…
Reference in a new issue