diff options
author | Linnea Gräf <nea@nea.moe> | 2024-08-11 13:22:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-11 13:22:24 +0200 |
commit | 8903d9fa783455558d20eb32a2038c87ab5913be (patch) | |
tree | 2c925d0ecf625f8e8a5505960d0d51d2201e88e2 /sharedVariables/src/ProjectTarget.kt | |
parent | a8d4861b051298cc8a1db3c5210a32abab866b1e (diff) | |
download | skyhanni-8903d9fa783455558d20eb32a2038c87ab5913be.tar.gz skyhanni-8903d9fa783455558d20eb32a2038c87ab5913be.tar.bz2 skyhanni-8903d9fa783455558d20eb32a2038c87ab5913be.zip |
Add multi version preprocessor (#2283)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'sharedVariables/src/ProjectTarget.kt')
-rw-r--r-- | sharedVariables/src/ProjectTarget.kt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/sharedVariables/src/ProjectTarget.kt b/sharedVariables/src/ProjectTarget.kt new file mode 100644 index 000000000..9bf46c781 --- /dev/null +++ b/sharedVariables/src/ProjectTarget.kt @@ -0,0 +1,74 @@ +package at.skyhanni.sharedvariables + +private fun yarn(version: String): String = "net.fabricmc:yarn:${version}:v2" + +enum class ProjectTarget( + val projectName: String, + val minecraftVersion: MinecraftVersion, + val mappingDependency: String, + val mappingStyle: MappingStyle, + val forgeDep: String?, + linkTo: String?, +) { + MAIN( + "1.8.9", + MinecraftVersion.MC189, + "de.oceanlabs.mcp:mcp_stable:22-1.8.9@zip", + MappingStyle.SEARGE, + "net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9", + "BRIDGE112", + ), + BRIDGE112( + "1.12.2", + MinecraftVersion.MC11202, + "de.oceanlabs.mcp:mcp_stable:39-1.12@zip", + MappingStyle.SEARGE, + "net.minecraftforge:forge:1.12.2-14.23.5.2847", + "BRIDGE116FORGE", + ), + BRIDGE116FORGE( + "1.16.5-forge", + MinecraftVersion.MC11605, + "official", + MappingStyle.SEARGE, + "net.minecraftforge:forge:1.16.5-36.2.39", + "BRIDGE116FABRIC", + ), + BRIDGE116FABRIC( + "1.16.5", + MinecraftVersion.MC11605, + yarn("1.16.5+build.10"), + MappingStyle.YARN, + null, + "MODERN", + ), + MODERN( + "1.21", + MinecraftVersion.MC121, + yarn("1.21+build.9"), + MappingStyle.YARN, + null, + null, + ) + ; + + val isBridge get() = name.contains("bridge") + + val linkTo by lazy { + if (linkTo == null) null + else { + ProjectTarget.values().find { it.name == linkTo }!! + } + } + val parent by lazy { + values().find { it.linkTo == this } + } + val isForge get() = forgeDep != null + val isFabric get() = forgeDep == null + + val projectPath get() = ":$projectName" + + companion object { + fun activeVersions() = values().filter { MultiVersionStage.activeState.shouldCreateProject(it) } + } +} |