correct defaults for the separate parchmentVersion parameter
All checks were successful
Publish to snapshot maven / build (push) Successful in 30s

This commit is contained in:
moehreag 2024-06-15 16:26:17 +02:00
parent c4be767566
commit a42520d14f
3 changed files with 10 additions and 9 deletions

View file

@ -7,7 +7,7 @@ plugins {
}
group = "dev.frogmc"
version = "0.0.1-alpha.8"
version = "0.0.1-alpha.9"
repositories {
maven {

View file

@ -5,10 +5,10 @@ import org.gradle.api.provider.Provider
@Suppress("unused")
interface PhytotelmaGradleExtension {
fun minecraft(version: String, parchmentGameVersion: String = version, parchmentVersion: String? = null)
fun minecraft(version: String, parchmentGameVersion: String? = null, parchmentVersion: String? = null)
fun minecraft(version: Provider<String>, parchmentGameVersion: Provider<String> = version, parchmentVersion: Provider<String>? = null) {
minecraft(version.get(), parchmentGameVersion.get(), parchmentVersion?.get())
fun minecraft(version: Provider<String>, parchmentGameVersion: Provider<String>? = null, parchmentVersion: Provider<String>? = null) {
minecraft(version.get(), parchmentGameVersion?.get(), parchmentVersion?.get())
}
fun loader(version: String)

View file

@ -20,11 +20,12 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
@Inject
abstract fun getProject(): Project
override fun minecraft(version: String, parchmentGameVersion: String, parchmentVersion: String?) {
override fun minecraft(version: String, parchmentGameVersion: String?, parchmentVersion: String?) {
if (VersionChecker.validateVersion(version, offlineMode = getProject().gradle.startParameter.isOffline)) {
println("Setting up Minecraft...")
val parchmentGameVer = parchmentGameVersion?: version
val parchment =
parchmentVersion ?: kotlin.runCatching { ParchmentProvider.findForMinecraftVersion(version) }
parchmentVersion ?: kotlin.runCatching { ParchmentProvider.findForMinecraftVersion(parchmentGameVer) }
.getOrDefault("")
val projectData = ProjectStorage.get(getProject())
projectData.minecraftVersion = version
@ -49,8 +50,8 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
}.getOrNull()
val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching {
ParchmentProvider.getParchment(
parchmentGameVersion, parchment,
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVersion/$parchment"),
parchmentGameVer, parchment,
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVer/$parchment"),
getProject().gradle.startParameter.isRefreshDependencies
)
}.getOrNull() else {
@ -58,7 +59,7 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
null
}
if (paramMappings == null && parchment.isNotEmpty()) {
println("Parameter mappings will not be present as the version $parchmentVersion for minecraft version $parchmentGameVersion could not be found")
println("Parameter mappings will not be present as the version $parchmentVersion for minecraft version $parchmentGameVer could not be found")
}
if (data != null) {
Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings)