@@ -15,31 +15,15 @@ plugins {
1515
1616}
1717
18- import java.nio.file.Files
19- import java.nio.file.Paths
20-
21- def loadEnv () {
22- def envFile = rootProject. file(" .env" )
23- if (envFile. exists()) {
24- envFile. eachLine { line ->
25- def matcher = line =~ / ^\s *([\w\. ]+)\s *=\s *(.*)\s *$/
26- if (matcher. matches()) {
27- def key = matcher[0 ][1 ]
28- def value = matcher[0 ][2 ]
29- System . setProperty(key as String , value as String )
30- }
31- }
32- }
33- }
34-
35- loadEnv()
3618version = minecraft_version + " -" + mod_version
3719group = mod_group_id
3820
3921base {
4022 archivesName = mod_id
4123}
4224
25+ jarJar. enable()
26+
4327// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
4428java. toolchain. languageVersion = JavaLanguageVersion . of(17 )
4529
@@ -159,7 +143,10 @@ dependencies {
159143 testImplementation ' org.junit.jupiter:junit-jupiter-api:5.10.0'
160144 testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.10.0'
161145 // x chart to plot things
162- implementation(" org.knowm.xchart:xchart:3.2.2" )
146+ jarJar(implementation(" org.knowm.xchart:xchart:3.2.2" )){
147+ jarJar. ranged(it, ' [3.2.2,)' )
148+ }
149+
163150
164151 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings
165152 // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly
@@ -236,11 +223,6 @@ tasks.jarJar.finalizedBy('reobfJarJar')
236223
237224// Example configuration to allow publishing using the maven-publish plugin
238225
239- // def reobfJarFile = tasks.named('jar').get().archiveFile.get().asFile.absolutePath
240- /* tasks.remapJar {
241- archiveClassifier.set("mapped_official_${minecraft_version}")
242- }*/
243-
244226publishing {
245227 publications {
246228 mavenJava(MavenPublication ) {
@@ -252,45 +234,7 @@ publishing {
252234 }
253235 }
254236}
255- /*
256- tasks.register("fixModuleMetadata") {
257- dependsOn("publishMavenJavaPublicationToMavenLocal")
258- doLast {
259- def moduleFile = file("$buildDir/publications/mavenJava/module.json")
260- if (moduleFile.exists()) {
261- def text = moduleFile.text
262- def cleaned = text.replaceAll(/_mapped_official_\d+\.\d+\.\d+/, '')
263- if (text != cleaned) {
264- println "Fixing module metadata versions in ${moduleFile}"
265- moduleFile.text = cleaned
266- }
267- } else {
268- println "Module metadata file not found: ${moduleFile}"
269- }
270- }
271- }
272- afterEvaluate {
273- publishing {
274- publications {
275- mavenJava(MavenPublication) {
276- pom.withXml {
277- asNode().dependencies?.dependency?.each { dep ->
278- def versionNodes = dep.version
279- if (versionNodes != null && versionNodes.size() > 0) {
280- def versionNode = versionNodes[0] // get first Node from NodeList
281- def versionText = versionNode.text()
282- def cleaned = versionText.replaceAll(/_mapped_official_\d+\.\d+\.\d+/, '')
283- if (versionText != cleaned) {
284- println "Cleaning version: ${versionText} -> ${cleaned}"
285- versionNode.setValue(cleaned)
286- }
287- }
288- }
289- }
290- }
291- }
292- }
293- }*/
237+
294238tasks. withType(JavaCompile ). configureEach {
295239 options. encoding = ' UTF-8' // Use the UTF-8 charset for Java compilation
296240}
0 commit comments