diff --git a/build.gradle b/build.gradle index ba97e3c06..0b9c4e23f 100644 --- a/build.gradle +++ b/build.gradle @@ -95,6 +95,39 @@ allprojects { p -> } } + + // Put stuff from gradle.properties into the mod info + processResources { + def resourceTargets = ["fabric.mod.json", "META-INF/mods.toml"] // Location of where to put + def intoTargets = ["$buildDir/resources/main/"] // Location of the built resources folder + def replaceProperties = [ + version: mod_version, + mod_name: mod_name, + authors: mod_authors, + description: mod_description, + homepage: mod_homepage + ] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties + + inputs.properties replaceProperties + replaceProperties.put 'project', project + filesMatching(resourceTargets) { + expand replaceProperties + } + + intoTargets.each { target -> + if (file(target).exists()) { + copy { + from(sourceSets.main.resources) { + include resourceTargets + expand replaceProperties + } + into target + } + } + } + } + + tasks.withType(JavaCompile) { if (p != project(":core")) { // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. diff --git a/core b/core index 4bcb6c0ac..ca81ed1ef 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 4bcb6c0acd5e31a247d7c706e3fcf99cedb236dc +Subproject commit ca81ed1efef9b117ff848124b06bca8c27d182b4 diff --git a/fabric/build.gradle b/fabric/build.gradle index 1d61b2718..5b452f67a 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -113,36 +113,8 @@ runClient { finalizedBy(deleteResources) } -// Put stuff from gradle.properties into the mod info stuff -def resourceTargets = ["fabric.mod.json"] -def intoTargets = ["$buildDir/resources/main/"] -def replaceProperties = [ - version: mod_version, - mod_name: mod_name, - authors: mod_authors, - description: mod_description -] - processResources { dependsOn(copyAccessWidener) - - inputs.properties replaceProperties - replaceProperties.put 'project', project - filesMatching(resourceTargets) { - expand replaceProperties - } - - intoTargets.each { target -> - if (file(target).exists()) { - copy { - from(sourceSets.main.resources) { - include resourceTargets - expand replaceProperties - } - into target - } - } - } } shadowJar { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 216a12cb9..f32fdcb73 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -8,7 +8,7 @@ "authors": ["${authors}"], "contact": { - "homepage": "https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail", + "homepage": "${homepage}", "sources": "https://gitlab.com/jeseibel/minecraft-lod-mod/", "issues": "https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues" }, diff --git a/forge/build.gradle b/forge/build.gradle index 91ba3f8d5..efebf5a0e 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -57,37 +57,9 @@ task copyCommonResources(type: Copy) { into file("build/resources/main") } -// Put stuff from gradle.properties into the mod info stuff -def resourceTargets = ["META-INF/mods.toml"] -def intoTargets = ["$buildDir/resources/main/"] -def replaceProperties = [ - version: mod_version, - mod_name: mod_name, - authors: mod_authors, - description: mod_description -] - processResources { dependsOn(copyCoreResources) dependsOn(copyCommonResources) - - inputs.properties replaceProperties - replaceProperties.put 'project', project - filesMatching(resourceTargets) { - expand replaceProperties - } - - intoTargets.each { target -> - if (file(target).exists()) { - copy { - from(sourceSets.main.resources) { - include resourceTargets - expand replaceProperties - } - into target - } - } - } } shadowJar { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index ccd7a060c..65a8b9e1f 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -9,14 +9,13 @@ issueTrackerURL="https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues" modId="lod" #//mandatory version= "${version}" #//mandatory, gets the version number from jar populated by the build.gradle script displayName="${mod_name}" #//mandatory + authors="${authors}" #//updateJSONURL="https://change.me.example.invalid/updates.json" # A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/ - displayURL="https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail" + displayURL="${homepage}" + description= "${description}" #//mandatory. The description text for the mod logoFile="logo.png" catalogueImageIcon="icon.png" credits="Massive thanks to: Leonardo, Cola, Ran, and CoolGi. For their hard work to bring Distant Horizons to where it is today. - James" - authors="${authors}" - #//mandatory. The description text for the mod - description= ''' ${description} ''' #// if not set defaults to "false" clientSideOnly="true" #// if not set defaults to "BOTH" diff --git a/gradle.properties b/gradle.properties index ddf150a4c..5fe335066 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,6 +11,7 @@ toml_version=3.6.4 mod_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. mod_authors=James Seibel, Leonardo Amato, Cola, coolGi2007, Ran, LeeTom +mod_homepage=https://www.curseforge.com/minecraft/mc-mods/lod-level-of-detail # Fabric loader fabric_loader_version=0.12.12