|
| 1 | +@file:Suppress("UnstableApiUsage") |
| 2 | + |
| 3 | +val license: String by project |
| 4 | +val loggingLevel: String by project |
| 5 | +val mixinDebugExport: String by project |
| 6 | +val mcVersion: String by project |
| 7 | +val modVersion: String by project |
| 8 | +val modPackage: String by project |
| 9 | +val modId: String by project |
| 10 | +val modName: String by project |
| 11 | +val modAuthor: String by project |
| 12 | +val modDescription: String by project |
| 13 | +val neoVersion: String by project |
| 14 | +val parchmentVersion: String by project |
| 15 | +val aeVersion: String by project |
| 16 | +val emiVersion: String by project |
| 17 | +val githubUser: String by project |
| 18 | +val githubRepo: String by project |
| 19 | + |
1 | 20 | plugins {
|
2 | 21 | id("net.neoforged.moddev") version "2.0.+"
|
3 |
| - id("com.almostreliable.almostgradle") |
| 22 | + id("com.github.gmazzo.buildconfig") version "4.0.4" |
| 23 | + java |
4 | 24 | }
|
5 | 25 |
|
6 |
| -almostgradle.setup { |
7 |
| - withSourcesJar = false |
8 |
| - recipeViewers.emi.mavenRepository |
| 26 | +base { |
| 27 | + version = "$mcVersion-$modVersion" |
| 28 | + group = modPackage |
| 29 | + archivesName.set("$modId-neoforge") |
9 | 30 | }
|
10 | 31 |
|
| 32 | +java.toolchain.languageVersion = JavaLanguageVersion.of(21) |
| 33 | + |
11 | 34 | neoForge {
|
| 35 | + version = neoVersion |
| 36 | + |
| 37 | + mods { |
| 38 | + create("merequester") { |
| 39 | + modSourceSets.add(sourceSets.main) |
| 40 | + } |
| 41 | + } |
| 42 | + |
12 | 43 | runs {
|
13 | 44 | configureEach {
|
| 45 | + gameDirectory = project.file("run") |
14 | 46 | systemProperties = mapOf(
|
| 47 | + "forge.logging.console.level" to loggingLevel, |
| 48 | + "mixin.debug.export" to mixinDebugExport, |
15 | 49 | "guideDev.ae2guide.sources" to file("guidebook").absolutePath,
|
16 |
| - "guideDev.ae2guide.sourcesNamespace" to almostgradle.modId |
| 50 | + "guideDev.ae2guide.sourcesNamespace" to modId |
17 | 51 | )
|
| 52 | + jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition") |
| 53 | + } |
| 54 | + create("client") { |
| 55 | + client() |
| 56 | + programArguments.addAll("--quickPlaySingleplayer", "New World") |
18 | 57 | }
|
19 |
| - |
20 | 58 | create("guide") {
|
21 | 59 | client()
|
22 |
| - systemProperty("guideDev.ae2guide.startupPage", "${almostgradle.modId}:${almostgradle.modId}.md") |
| 60 | + systemProperty("guideDev.ae2guide.startupPage", "$modId:$modId.md") |
| 61 | + } |
| 62 | + create("server") { |
| 63 | + server() |
23 | 64 | }
|
24 | 65 | }
|
| 66 | + |
| 67 | + parchment { |
| 68 | + minecraftVersion = "1.21" |
| 69 | + mappingsVersion = parchmentVersion |
| 70 | + } |
25 | 71 | }
|
26 | 72 |
|
27 | 73 | repositories {
|
28 |
| - maven("https://modmaven.dev") |
| 74 | + maven("https://modmaven.dev") // Applied Energistics 2 |
| 75 | + maven("https://maven.blamejared.com") // JEI |
| 76 | + maven("https://maven.shedaniel.me") // REI |
| 77 | + maven("https://maven.terraformersmc.com") // EMI |
29 | 78 | mavenLocal()
|
30 | 79 | }
|
31 | 80 |
|
32 | 81 | dependencies {
|
33 |
| - implementation("appeng:appliedenergistics2:${almostgradle.getProperty("aeVersion")}") |
| 82 | + implementation("appeng:appliedenergistics2:$aeVersion") |
| 83 | + runtimeOnly("dev.emi:emi-neoforge:$emiVersion+1.21") |
34 | 84 | }
|
35 | 85 |
|
36 |
| -tasks.withType<Jar> { |
37 |
| - from("guidebook") { |
38 |
| - into("assets/${almostgradle.modId}/ae2guide") |
| 86 | +tasks { |
| 87 | + processResources { |
| 88 | + val resourceTargets = listOf("META-INF/neoforge.mods.toml", "pack.mcmeta") |
| 89 | + |
| 90 | + val replaceProperties = mapOf( |
| 91 | + "license" to license, |
| 92 | + "mcVersion" to mcVersion, |
| 93 | + "version" to project.version as String, |
| 94 | + "modId" to modId, |
| 95 | + "modName" to modName, |
| 96 | + "modAuthor" to modAuthor, |
| 97 | + "modDescription" to modDescription, |
| 98 | + "neoVersion" to neoVersion, |
| 99 | + "aeVersion" to aeVersion, |
| 100 | + "githubUser" to githubUser, |
| 101 | + "githubRepo" to githubRepo |
| 102 | + ) |
| 103 | + |
| 104 | + println("[Process Resources] Replacing properties in resources: ") |
| 105 | + replaceProperties.forEach { (key, value) -> println("\t -> $key = $value") } |
| 106 | + |
| 107 | + inputs.properties(replaceProperties) |
| 108 | + filesMatching(resourceTargets) { |
| 109 | + expand(replaceProperties) |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + withType<JavaCompile> { |
| 114 | + options.encoding = "UTF-8" |
| 115 | + } |
| 116 | + |
| 117 | + withType<Jar> { |
| 118 | + from("guidebook") { |
| 119 | + into("assets/$modId/ae2guide") |
| 120 | + } |
39 | 121 | }
|
40 | 122 | }
|
| 123 | + |
| 124 | +buildConfig { |
| 125 | + buildConfigField("String", "MOD_ID", "\"$modId\"") |
| 126 | + buildConfigField("String", "MOD_NAME", "\"$modName\"") |
| 127 | + buildConfigField("String", "MOD_VERSION", "\"$version\"") |
| 128 | + packageName(modPackage) |
| 129 | + useJavaOutput() |
| 130 | +} |
0 commit comments