|
| 1 | +val neoVersion = property("neo_version").toString() |
| 2 | +val kotlinForgeVersion = property("kotlin_forge_version").toString() |
| 3 | +val mixinExtrasVersion = property("mixinextras_version").toString() |
| 4 | + |
| 5 | +architectury { |
| 6 | + platformSetupLoomIde() |
| 7 | + neoForge() |
| 8 | +} |
| 9 | + |
| 10 | +base.archivesName.set("${base.archivesName.get()}-neoforge") |
| 11 | + |
| 12 | +loom { |
| 13 | + accessWidenerPath.set(project(":common").loom.accessWidenerPath) |
| 14 | +} |
| 15 | + |
| 16 | +repositories { |
| 17 | + maven("https://maven.neoforged.net/releases/") |
| 18 | + maven("https://thedarkcolour.github.io/KotlinForForge/") |
| 19 | +} |
| 20 | + |
| 21 | +val common: Configuration by configurations.creating { |
| 22 | + configurations.compileClasspath.get().extendsFrom(this) |
| 23 | + configurations.runtimeClasspath.get().extendsFrom(this) |
| 24 | + configurations["developmentNeoForge"].extendsFrom(this) |
| 25 | +} |
| 26 | + |
| 27 | +val includeLib: Configuration by configurations.creating |
| 28 | +val includeMod: Configuration by configurations.creating |
| 29 | + |
| 30 | +fun DependencyHandlerScope.setupConfigurations() { |
| 31 | + includeLib.dependencies.forEach { |
| 32 | + implementation(it) |
| 33 | + include(it) |
| 34 | + } |
| 35 | + |
| 36 | + includeMod.dependencies.forEach { |
| 37 | + modImplementation(it) |
| 38 | + include(it) |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +dependencies { |
| 43 | + // NeoForge API |
| 44 | + neoForge("net.neoforged:neoforge:$neoVersion") |
| 45 | + |
| 46 | + // Add dependencies on the required Kotlin modules. |
| 47 | + includeLib("thedarkcolour:kotlinforforge:$kotlinForgeVersion") |
| 48 | + |
| 49 | + // Add mods to the mod jar |
| 50 | + // includeMod(...) |
| 51 | + |
| 52 | + // Common (Do not touch) |
| 53 | + common(project(":common", configuration = "namedElements")) { isTransitive = false } |
| 54 | + shadowCommon(project(path = ":common", configuration = "transformProductionNeoForge")) { isTransitive = false } |
| 55 | + |
| 56 | + // Finish the configuration |
| 57 | + setupConfigurations() |
| 58 | +} |
| 59 | + |
| 60 | +tasks { |
| 61 | + processResources { |
| 62 | + inputs.property("version", project.version) |
| 63 | + |
| 64 | + filesMatching("META-INF/mods.toml") { |
| 65 | + expand(getProperties()) |
| 66 | + expand(mutableMapOf("version" to project.version)) |
| 67 | + } |
| 68 | + } |
| 69 | +} |
0 commit comments