|
| 1 | +import java.time.ZonedDateTime |
| 2 | +import java.time.format.DateTimeFormatter |
| 3 | + |
1 | 4 | plugins { |
| 5 | + id("eclipse") |
2 | 6 | id("idea") |
3 | | - id("java-library") |
4 | | - id("net.neoforged.moddev") version "2.0.78" |
5 | | -} |
6 | | - |
7 | | -tasks.named<Wrapper>("wrapper").configure { |
8 | | - distributionType = Wrapper.DistributionType.BIN |
| 7 | + id("net.minecraftforge.gradle") version "[6.0,6.2)" |
| 8 | + id("org.parchmentmc.librarian.forgegradle") version "1.+" |
| 9 | + id("org.spongepowered.mixin") version "0.7.+" |
9 | 10 | } |
10 | 11 |
|
11 | 12 | val modVersion: String by extra |
12 | | -val neoVersion: String by extra |
| 13 | +val forgeVersion: String by extra |
13 | 14 | val parchmentMappingsVersion: String by extra |
14 | | -val parchmentMinecraftVersion: String by extra |
15 | 15 | val minecraftVersion: String by extra |
16 | | -val neoVersionRange: String by extra |
| 16 | +val forgeVersionRange: String by extra |
17 | 17 | val loaderVersionRange: String by extra |
18 | 18 | val mekanismVersion: String by extra |
19 | 19 | val mekanismVersionRange: String by extra |
20 | 20 | val curiosVersion: String by extra |
21 | 21 | val curiosVersionRange: String by extra |
22 | 22 |
|
23 | | -version = modVersion |
| 23 | +version = "$minecraftVersion-$modVersion" |
24 | 24 | group = "dev.tonimatas.mekanismcurios" |
25 | 25 |
|
26 | 26 | base { |
27 | 27 | archivesName = "mekanismcurios" |
28 | 28 | } |
29 | 29 |
|
30 | | -java.toolchain.languageVersion = JavaLanguageVersion.of(21) |
| 30 | +java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
31 | 31 |
|
32 | | -neoForge { |
33 | | - version = neoVersion |
| 32 | +minecraft { |
| 33 | + mappings("parchment", "$parchmentMappingsVersion-$minecraftVersion") |
34 | 34 |
|
35 | | - parchment { |
36 | | - mappingsVersion = parchmentMappingsVersion |
37 | | - minecraftVersion = parchmentMinecraftVersion |
38 | | - } |
| 35 | + copyIdeResources = true |
39 | 36 |
|
40 | 37 | runs { |
41 | 38 | create("client") { |
42 | | - client() |
43 | | - systemProperty("neoforge.enabledGameTestNamespaces", "mekanismcurios") |
| 39 | + property("forge.enabledGameTestNamespaces", "mekanismcurios") |
44 | 40 | } |
45 | 41 |
|
46 | 42 | create("server") { |
47 | | - server() |
48 | | - programArgument("--nogui") |
49 | | - systemProperty("neoforge.enabledGameTestNamespaces", "mekanismcurios") |
| 43 | + property("forge.enabledGameTestNamespaces", "mekanismcurios") |
| 44 | + args("--nogui") |
50 | 45 | } |
51 | 46 |
|
52 | 47 | create("data") { |
53 | | - data() |
54 | | - programArguments.addAll("--mod", "mekanismcurios", "--all", "--output", file("src/generated/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath) |
| 48 | + workingDirectory(project.file("run-data")) |
| 49 | + args("--mod", "mekanismcurios", "--all", "--output", file("src/generated/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath) |
55 | 50 | } |
56 | 51 |
|
57 | 52 | configureEach { |
58 | | - systemProperty("forge.logging.markers", "REGISTRIES") |
59 | | - logLevel = org.slf4j.event.Level.DEBUG |
60 | | - } |
61 | | - } |
62 | | - |
63 | | - mods { |
64 | | - create("mekanismcurios") { |
65 | | - sourceSet(sourceSets.main.get()) |
| 53 | + workingDirectory(project.file("run")) |
| 54 | + property("forge.logging.markers", "REGISTRIES") |
| 55 | + property("forge.logging.console.level", "debug") |
| 56 | + property("mixin.env.remapRefMap", "true") |
| 57 | + property("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg") |
| 58 | + |
| 59 | + mods { |
| 60 | + create("mekanismcurios") { |
| 61 | + source(sourceSets.main.get()) |
| 62 | + } |
| 63 | + } |
66 | 64 | } |
67 | 65 | } |
68 | 66 | } |
69 | 67 |
|
70 | 68 | sourceSets.main.get().resources { srcDir("src/generated/resources") } |
71 | 69 |
|
72 | | -val localRuntime: Configuration by configurations.creating |
73 | | - |
74 | | -configurations["runtimeClasspath"].extendsFrom(localRuntime) |
| 70 | +mixin { |
| 71 | + add(sourceSets.main.get(), "mekanismcurios.refmap.json") |
| 72 | + config("mekanismcurios.mixins.json") |
| 73 | +} |
75 | 74 |
|
76 | 75 | repositories { |
77 | 76 | maven("https://modmaven.dev/") |
78 | 77 | maven("https://maven.theillusivec4.top/") |
79 | 78 | } |
80 | 79 |
|
81 | 80 | dependencies { |
82 | | - compileOnly("mekanism:Mekanism:$minecraftVersion-$mekanismVersion:api") |
83 | | - compileOnly("mekanism:Mekanism:$minecraftVersion-$mekanismVersion") |
84 | | - compileOnly("top.theillusivec4.curios:curios-neoforge:$curiosVersion+$minecraftVersion:api") |
85 | | - localRuntime("mekanism:Mekanism:$minecraftVersion-$mekanismVersion") |
86 | | - runtimeOnly("top.theillusivec4.curios:curios-neoforge:$curiosVersion+$minecraftVersion") |
| 81 | + minecraft("net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}") |
| 82 | + annotationProcessor("org.spongepowered:mixin:0.8.5:processor") |
| 83 | + compileOnly(fg.deobf("mekanism:Mekanism:$minecraftVersion-$mekanismVersion:api")) |
| 84 | + compileOnly(fg.deobf("mekanism:Mekanism:$minecraftVersion-$mekanismVersion")) |
| 85 | + compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:$curiosVersion+$minecraftVersion:api")) |
| 86 | + runtimeOnly(fg.deobf("mekanism:Mekanism:$minecraftVersion-$mekanismVersion")) |
| 87 | + runtimeOnly(fg.deobf("top.theillusivec4.curios:curios-forge:$curiosVersion+$minecraftVersion")) |
87 | 88 | } |
88 | 89 |
|
89 | 90 | tasks.processResources { |
90 | 91 | var replaceProperties = mapOf("modVersion" to modVersion, "loaderVersionRange" to loaderVersionRange, |
91 | | - "neoVersionRange" to neoVersionRange, "minecraftVersion" to minecraftVersion, |
| 92 | + "forgeVersionRange" to forgeVersionRange, "minecraftVersion" to minecraftVersion, |
92 | 93 | "mekanismVersionRange" to mekanismVersionRange, "curiosVersionRange" to curiosVersionRange) |
93 | 94 |
|
94 | 95 | inputs.properties(replaceProperties) |
95 | | - filesMatching("META-INF/neoforge.mods.toml") { |
| 96 | + filesMatching("META-INF/mods.toml") { |
96 | 97 | expand(replaceProperties) |
97 | 98 | } |
98 | 99 | } |
99 | 100 |
|
100 | | -tasks.withType<JavaCompile> { |
101 | | - options.encoding = "UTF-8" |
| 101 | +tasks.named<Jar>("jar") { |
| 102 | + manifest { |
| 103 | + attributes( |
| 104 | + mapOf( |
| 105 | + "Specification-Title" to "mekanismcurios", |
| 106 | + "Specification-Vendor" to "TonimatasDEV", |
| 107 | + "Specification-Version" to "1", |
| 108 | + "Implementation-Title" to "Mekanism Curios", |
| 109 | + "Implementation-Version" to project.tasks.jar.get().archiveVersion.get(), |
| 110 | + "Implementation-Vendor" to "TonimatasDEV", |
| 111 | + "Implementation-Timestamp" to ZonedDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ")), |
| 112 | + "MixinConfigs" to "mekanismcurios.mixins.json" |
| 113 | + ) |
| 114 | + ) |
| 115 | + } |
| 116 | + |
| 117 | + finalizedBy("reobfJar") |
102 | 118 | } |
103 | 119 |
|
104 | | -idea { |
105 | | - module { |
106 | | - isDownloadSources = true |
107 | | - isDownloadJavadoc = true |
108 | | - } |
| 120 | +tasks.withType<JavaCompile> { |
| 121 | + options.encoding = "UTF-8" |
109 | 122 | } |
0 commit comments