diff options
Diffstat (limited to 'archenemyexample/build.gradle.kts')
-rw-r--r-- | archenemyexample/build.gradle.kts | 133 |
1 files changed, 79 insertions, 54 deletions
diff --git a/archenemyexample/build.gradle.kts b/archenemyexample/build.gradle.kts index 7ae9646..ca4313a 100644 --- a/archenemyexample/build.gradle.kts +++ b/archenemyexample/build.gradle.kts @@ -1,75 +1,100 @@ import moe.nea.archenemy.MCSide plugins { - kotlin("multiplatform") version "1.9.10" + kotlin("multiplatform") version "1.9.22" id("moe.nea.archenemy.mojang") } repositories { mavenCentral() maven("https://maven.fabricmc.net") + maven("https://repo.nea.moe/releases") + mavenLocal() } -val minecraftClient = mojang.minecraft("1.20.2", MCSide.CLIENT) as ModuleDependency -val minecraftServer = mojang.minecraft("1.20.2", MCSide.CLIENT) as ModuleDependency -val officialMappings = mojang.officialMappings( - "1.20.2", MCSide.CLIENT -) -val yarnMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:yarn:1.20.2+build.4:v2")) -val intermediaryMappings = mojang.intermediaryMappings("1.20.2") +kotlin.jvmToolchain(8) val whateverAttribute = Attribute.of("whatever", String::class.java) -kotlin { - val allJvm by sourceSets.creating { - this.dependencies { - } +val allJvm by kotlin.sourceSets.creating { + this.dependencies { } - jvm("forge") { - attributes.attribute(whateverAttribute, "forge") - compilations.named("main").get().run { - defaultSourceSet.dependsOn(allJvm) - this.dependencies { - implementation( - mojang.mapJar( - minecraftClient, - officialMappings, - "official", - "named" - ) - ) - } +} +val forge = kotlin.jvm("forge") { + attributes.attribute(whateverAttribute, "forge") + compilations.named("main").get().run { + defaultSourceSet.dependsOn(allJvm) + this.dependencies { + val mcpMappings = mojang.yarnMappings(dependencies.create("moe.nea.mcp:mcp-yarn:1.8.9:v2")) + val minecraftClient = mojang.minecraft("1.8.9", MCSide.CLIENT) + val mappedClient = mojang.mapJar(minecraftClient, mcpMappings, "official", "named") + implementation(mappedClient) + implementation("net.minecraft:launchwrapper:1.12") + mojang.libraries("1.8.9").forEach(::implementation) } } - jvm("fabric") { - attributes.attribute(whateverAttribute, "fabric") - compilations.named("main").get().run { - defaultSourceSet.dependsOn(allJvm) - this.dependencies { - val intermediaryClient = mojang.mapJar( - minecraftClient, - intermediaryMappings, - "official", - "intermediary" - ) - val intermediaryServer = mojang.mapJar( - minecraftServer, - intermediaryMappings, - "official", - "intermediary" - ) - val thingy = mojang.mergeJar( - intermediaryClient, intermediaryServer - ) - implementation( - mojang.mapJar( - thingy as ModuleDependency, - yarnMappings, - "intermediary", - "named" - ) +} +val mainForge = forge.compilations.getByName("main") +val fabric = kotlin.jvm("fabric") { + attributes.attribute(whateverAttribute, "fabric") + compilations.named("main").get().run { + defaultSourceSet.dependsOn(allJvm) + this.dependencies { + val minecraftClient = mojang.minecraft("1.20.2", MCSide.CLIENT) + val minecraftServer = mojang.minecraft("1.20.2", MCSide.SERVER) + val intermediaryMappings = mojang.intermediaryMappings("1.20.2") + val yarnMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:yarn:1.20.2+build.4:v2")) + val intermediaryClient = mojang.mapJar( + minecraftClient, + intermediaryMappings, + "official", + "intermediary" + ) + val intermediaryServer = mojang.mapJar( + minecraftServer, + intermediaryMappings, + "official", + "intermediary" + ) + val thingy = mojang.mergeJar( + intermediaryClient, intermediaryServer + ) + implementation( + mojang.mapJar( + thingy, + yarnMappings, + "intermediary", + "named" ) - } + ) } } } +tasks.create("runForge189", JavaExec::class) { + description = "Run Forge 1.8.9" + group = ApplicationPlugin.APPLICATION_GROUP + mainClass.set("net.minecraft.launchwrapper.Launch") + val downloadTask = archenemyShared.getDownloadAssetsTask("1.8.9") + dependsOn(downloadTask) + classpath(mainForge.runtimeDependencyFiles, tasks.getByName("forgeJar")) + javaLauncher.set(javaToolchains.launcherFor { + this.languageVersion.set(JavaLanguageVersion.of(8)) + }) + val runFolder = project.file("run") + runFolder.mkdirs() + workingDir(runFolder) + doFirst { + args( + "--assetDir", + downloadTask.getAssetDir().absolutePath, + "--assetIndex", + downloadTask.getAssetIndex(), + "--accessToken", + "undefined", + "--gameDir", + runFolder.absolutePath, + "--tweakClass", + "moe.nea.aee.forge.Tweaker" + ) + } +} |