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" group = "dev.frogmc"
version = "0.0.1-alpha.8" version = "0.0.1-alpha.9"
repositories { repositories {
maven { maven {

View file

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

View file

@ -20,11 +20,12 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
@Inject @Inject
abstract fun getProject(): Project 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)) { if (VersionChecker.validateVersion(version, offlineMode = getProject().gradle.startParameter.isOffline)) {
println("Setting up Minecraft...") println("Setting up Minecraft...")
val parchmentGameVer = parchmentGameVersion?: version
val parchment = val parchment =
parchmentVersion ?: kotlin.runCatching { ParchmentProvider.findForMinecraftVersion(version) } parchmentVersion ?: kotlin.runCatching { ParchmentProvider.findForMinecraftVersion(parchmentGameVer) }
.getOrDefault("") .getOrDefault("")
val projectData = ProjectStorage.get(getProject()) val projectData = ProjectStorage.get(getProject())
projectData.minecraftVersion = version projectData.minecraftVersion = version
@ -49,8 +50,8 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
}.getOrNull() }.getOrNull()
val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching { val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching {
ParchmentProvider.getParchment( ParchmentProvider.getParchment(
parchmentGameVersion, parchment, parchmentGameVer, parchment,
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVersion/$parchment"), PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVer/$parchment"),
getProject().gradle.startParameter.isRefreshDependencies getProject().gradle.startParameter.isRefreshDependencies
) )
}.getOrNull() else { }.getOrNull() else {
@ -58,7 +59,7 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
null null
} }
if (paramMappings == null && parchment.isNotEmpty()) { 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) { if (data != null) {
Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings) Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings)