Scripts/lom/src/main/kotlin/io/gitlab/jfronny/scripts/LomExtension.kt

37 lines
1.2 KiB
Kotlin
Raw Normal View History

package io.gitlab.jfronny.scripts
2022-10-06 19:30:52 +02:00
import org.gradle.api.Project
import org.gradle.api.provider.Property
import java.util.*
interface LomExtension {
val yarnBuild: Property<String>
2022-10-06 19:30:52 +02:00
fun yarn(yarnBuild: String) {
this.yarnBuild.set(Objects.requireNonNull(yarnBuild))
2022-10-06 19:30:52 +02:00
}
fun mojmap() {
yarnBuild.set(null)
2022-10-06 19:30:52 +02:00
}
val minecraftVersion: Property<String>
val fabricLoaderVersion: Property<String>
val neoforgeVersion: Property<String>
2022-10-06 19:30:52 +02:00
fun check(proj: Project) {
yarnBuild.finalizeValue()
minecraftVersion.finalizeValue()
fabricLoaderVersion.finalizeValue()
neoforgeVersion.finalizeValue()
require(!(fabricLoaderVersion.isPresent && neoforgeVersion.isPresent)) { "fabricLoaderVersion and forgeVersion are mutually exclusive" }
require(fabricLoaderVersion.isPresent || neoforgeVersion.isPresent) { "fabricLoaderVersion or forgeVersion must be set" }
}
fun copyFrom(ext: LomExtension) {
yarnBuild.set(ext.yarnBuild)
minecraftVersion.set(ext.minecraftVersion)
fabricLoaderVersion.set(ext.fabricLoaderVersion)
neoforgeVersion.set(ext.neoforgeVersion)
2022-10-06 19:30:52 +02:00
}
}