2022-10-07 16:03:38 +02:00
|
|
|
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 {
|
2024-03-21 12:57:11 +01:00
|
|
|
val loaderKind: Property<LoaderKind>
|
|
|
|
val minecraftVersion: Property<String>
|
|
|
|
val loaderVersion: Property<String>
|
2023-07-09 16:47:13 +02:00
|
|
|
val yarnBuild: Property<String>
|
2022-10-06 19:30:52 +02:00
|
|
|
|
|
|
|
fun yarn(yarnBuild: String) {
|
2023-07-09 16:47:13 +02:00
|
|
|
this.yarnBuild.set(Objects.requireNonNull(yarnBuild))
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fun mojmap() {
|
2023-07-09 16:47:13 +02:00
|
|
|
yarnBuild.set(null)
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
|
|
|
|
2023-07-09 16:47:13 +02:00
|
|
|
fun check(proj: Project) {
|
|
|
|
yarnBuild.finalizeValue()
|
|
|
|
minecraftVersion.finalizeValue()
|
2024-03-21 12:57:11 +01:00
|
|
|
loaderVersion.finalizeValue()
|
|
|
|
loaderKind.finalizeValue()
|
2023-07-09 16:47:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fun copyFrom(ext: LomExtension) {
|
2024-03-21 13:26:56 +01:00
|
|
|
if (loaderKind.get() != ext.loaderKind.get()) {
|
2024-03-21 12:57:11 +01:00
|
|
|
throw IllegalArgumentException("Cannot copy from a config meant for a different loader")
|
|
|
|
}
|
2023-07-09 16:47:13 +02:00
|
|
|
yarnBuild.set(ext.yarnBuild)
|
|
|
|
minecraftVersion.set(ext.minecraftVersion)
|
2024-03-21 12:57:11 +01:00
|
|
|
loaderVersion.set(ext.loaderVersion)
|
2022-10-06 19:30:52 +02:00
|
|
|
}
|
|
|
|
}
|