diff --git a/mod/common/build.gradle b/mod/common/build.gradle index f7859d4f..999ab4b2 100644 --- a/mod/common/build.gradle +++ b/mod/common/build.gradle @@ -3,45 +3,37 @@ plugins { id("net.kyori.blossom") version "1.3.1" } +architectury { + injectInjectables = false + common(rootProject.enabled_platforms.split(",")) +} + dependencies { // We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies // Do NOT use other classes from fabric loader modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - // https://modrinth.com/mod/voxelmap-updated/version/1.18.2-1.11.2 (1.11.2 fabric) - modCompileOnly "maven.modrinth:voxelmap-updated:SDVTG1wT" + modCompileOnly("maven.modrinth:voxelmap-updated:SDVTG1wT") // https://modrinth.com/mod/journeymap/version/1.18.2-5.9.7-fabric (5.9.7 fabric) - modCompileOnly "maven.modrinth:journeymap:5JbcGXLn" + modCompileOnly("maven.modrinth:journeymap:5JbcGXLn") // https://modrinth.com/mod/xaeros-minimap/version/23.6.2_Fabric_1.18.2 (23.6.2 fabric) - modCompileOnly "maven.modrinth:xaeros-minimap:Jwydpps9" -} - -architectury { - common(rootProject.enabled_platforms.split(",")) + modCompileOnly("maven.modrinth:xaeros-minimap:Jwydpps9") } tasks { blossom { replaceToken ( - "%VERSION%", - project.version, - "src/main/java/gjum/minecraft/mapsync/common/MapSyncMod.java" + "%VERSION%", + project.version, + "src/main/java/gjum/minecraft/mapsync/common/MapSyncMod.java" ) } } -publishing { - publications { - mavenCommon(MavenPublication) { - artifactId = rootProject.archives_base_name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. +processResources { + filesMatching("assets/mapsync/lang/en_us.json") { + expand(rootProject.properties) } } diff --git a/mod/common/src/main/resources/assets/map-sync/lang/en_us.json b/mod/common/src/main/resources/assets/map-sync/lang/en_us.json deleted file mode 100644 index 1f439487..00000000 --- a/mod/common/src/main/resources/assets/map-sync/lang/en_us.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "key.map-sync.openGui": "Open GUI", - "category.map-sync": "Map Sync" -} diff --git a/mod/common/src/main/resources/assets/mapsync/lang/en_us.json b/mod/common/src/main/resources/assets/mapsync/lang/en_us.json new file mode 100644 index 00000000..1dfbf945 --- /dev/null +++ b/mod/common/src/main/resources/assets/mapsync/lang/en_us.json @@ -0,0 +1,4 @@ +{ + "key.map-sync.openGui": "Open GUI", + "category.map-sync": "${mod_display_name}" +} diff --git a/mod/common/src/main/resources/mixin.map-sync.json b/mod/common/src/main/resources/mapsync.common.mixins.json similarity index 100% rename from mod/common/src/main/resources/mixin.map-sync.json rename to mod/common/src/main/resources/mapsync.common.mixins.json diff --git a/mod/fabric/build.gradle b/mod/fabric/build.gradle index 276503ee..f11d87c1 100644 --- a/mod/fabric/build.gradle +++ b/mod/fabric/build.gradle @@ -1,3 +1,5 @@ +import groovy.json.JsonBuilder + plugins { id "com.github.johnrengelman.shadow" version "7.1.2" } @@ -16,32 +18,25 @@ configurations { } dependencies { - modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" + modImplementation("net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}") + modApi("net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}") common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } - - - // https://modrinth.com/mod/voxelmap-updated/version/1.18.2-1.11.2 (1.11.2 fabric) - modCompileOnly "maven.modrinth:voxelmap-updated:SDVTG1wT" - // https://modrinth.com/mod/journeymap/version/1.18.2-5.9.7-fabric (5.9.7 fabric) - modCompileOnly "maven.modrinth:journeymap:5JbcGXLn" - // https://modrinth.com/mod/xaeros-minimap/version/23.6.2_Fabric_1.18.2 (23.6.2 fabric) - modCompileOnly "maven.modrinth:xaeros-minimap:Jwydpps9" - - - // https://modrinth.com/mod/modmenu/version/3.2.5 (3.2.5 fabric) - modCompileOnly "maven.modrinth:modmenu:nVxObSbX" + modCompileOnly("maven.modrinth:modmenu:nVxObSbX") } processResources { - inputs.property "version", project.version - filesMatching("fabric.mod.json") { - expand "version": project.version + expand(rootProject.properties) + filter { + (it as String).replace( + "\"%FABRIC_AUTHORS_ARRAY%\"", + new JsonBuilder((rootProject.properties["mod_authors"] as String).tokenize(",")).toString() + ) + } } } @@ -51,7 +46,7 @@ shadowJar { } remapJar { - input.set shadowJar.archiveFile + inputFile.set(shadowJar.archiveFile) dependsOn shadowJar classifier "fabric" } @@ -72,30 +67,16 @@ components.java { } } -publishing { - publications { - mavenFabric(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } -} - -tasks.register('cleanJar', Delete) { - delete fileTree('../dist') { +tasks.register("cleanJar", Delete) { + delete fileTree("../dist") { include "*-fabric.jar" } } -tasks.register('copyJar', Copy) { +tasks.register("copyJar", Copy) { + dependsOn cleanJar from remapJar - into '../dist' + into "../dist" } build.dependsOn copyJar -copyJar.dependsOn cleanJar diff --git a/mod/fabric/gradle.properties b/mod/fabric/gradle.properties new file mode 100644 index 00000000..e846a8f5 --- /dev/null +++ b/mod/fabric/gradle.properties @@ -0,0 +1 @@ +loom.platform=fabric diff --git a/mod/fabric/src/main/resources/fabric.mod.json b/mod/fabric/src/main/resources/fabric.mod.json index 1753d049..e862cf8b 100644 --- a/mod/fabric/src/main/resources/fabric.mod.json +++ b/mod/fabric/src/main/resources/fabric.mod.json @@ -1,18 +1,17 @@ { "schemaVersion": 1, - "id": "map-sync", - "version": "${version}", - "name": "Map Sync", - "description": "Sync map data with others instantly.", - "authors": [ - "Gjum" - ], + "id": "mapsync", + "version": "${mod_version}", + "name": "${mod_display_name}", + "description": "${mod_description}", + "authors": "%FABRIC_AUTHORS_ARRAY%", "contact": { - "homepage": "https://github.com/Gjum/map-sync", - "sources": "https://github.com/Gjum/map-sync" + "homepage": "${mod_home_url}", + "sources": "${mod_source_url}", + "issues": "${mod_issues_url}" }, - "license": "GPL-3.0-only", - "icon": "assets/map-sync/icon.png", + "license": "${copyright_licence}", + "icon": "assets/mapsync/icon.png", "environment": "client", "entrypoints": { "client": [ @@ -23,11 +22,12 @@ ] }, "depends": { - "fabricloader": ">=0.7.4", - "fabric": "*", - "minecraft": "1.18.x" + "minecraft": "${minecraft_version}", + "fabricloader": ">=${fabric_loader_version}", + "fabric": "*" }, "mixins": [ - "mixin.map-sync.json" + "mapsync.common.mixins.json", + "mapsync.fabric.mixins.json" ] } diff --git a/mod/fabric/src/main/resources/mapsync.fabric.mixins.json b/mod/fabric/src/main/resources/mapsync.fabric.mixins.json new file mode 100644 index 00000000..78cd499b --- /dev/null +++ b/mod/fabric/src/main/resources/mapsync.fabric.mixins.json @@ -0,0 +1,14 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "gjum.minecraft.mapsync.fabric.mixins", + "compatibilityLevel": "JAVA_17", + "mixins": [], + "client": [ + + ], + "server": [], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/mod/forge/build.gradle b/mod/forge/build.gradle index e1882c28..8eb12c2c 100644 --- a/mod/forge/build.gradle +++ b/mod/forge/build.gradle @@ -9,7 +9,7 @@ architectury { loom { forge { - mixinConfig "mixin.map-sync.json" + mixinConfig "mapsync.common.mixins.json", "mapsync.forge.mixins.json" } } @@ -22,24 +22,18 @@ configurations { } dependencies { - forge "net.minecraftforge:forge:${rootProject.forge_version}" + forge("net.minecraftforge:forge:${rootProject.forge_version}") common(project(path: ":common", configuration: "namedElements")) { transitive false } - shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } - - - - // https://modrinth.com/mod/journeymap/version/1.18.2-5.9.7-forge (5.9.7 forge) - modCompileOnly "maven.modrinth:journeymap:2G6aMzKY" - // https://modrinth.com/mod/xaeros-minimap/version/23.6.2_Forge_1.18.2 (23.6.2 forge) - modCompileOnly "maven.modrinth:xaeros-minimap:yFuICfIq" + shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false } } processResources { - inputs.property "version", project.version - filesMatching("META-INF/mods.toml") { - expand "version": project.version + expand(rootProject.properties) + } + filesMatching("pack.mcmeta") { + expand(rootProject.properties) } } @@ -51,7 +45,7 @@ shadowJar { } remapJar { - input.set shadowJar.archiveFile + inputFile.set(shadowJar.archiveFile) dependsOn shadowJar classifier "forge" } @@ -72,30 +66,16 @@ components.java { } } -publishing { - publications { - mavenForge(MavenPublication) { - artifactId = rootProject.archives_base_name + "-" + project.name - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - } -} - -tasks.register('cleanJar', Delete) { - delete fileTree('../dist') { +tasks.register("cleanJar", Delete) { + delete fileTree("../dist") { include "*-forge.jar" } } -tasks.register('copyJar', Copy) { +tasks.register("copyJar", Copy) { + dependsOn cleanJar from remapJar - into '../dist' + into "../dist" } build.dependsOn copyJar -copyJar.dependsOn cleanJar diff --git a/mod/forge/src/main/resources/META-INF/mods.toml b/mod/forge/src/main/resources/META-INF/mods.toml index ffc23c7e..9940224e 100644 --- a/mod/forge/src/main/resources/META-INF/mods.toml +++ b/mod/forge/src/main/resources/META-INF/mods.toml @@ -1,28 +1,27 @@ modLoader = "javafml" -loaderVersion = "[40,)" -issueTrackerURL = "https://github.com/CivPlatform/map-sync/issues" -license = "GPL-3.0-only" +loaderVersion = "[${forge_major_version},)" +issueTrackerURL = "${mod_issues_url}" +license = "${copyright_licence}" [[mods]] modId = "mapsync" -version = "${version}" -displayName = "Map Sync" -authors = "Gjum" -description = ''' -Sync map data with others instantly. -''' +version = "${mod_version}" +displayName = "${mod_display_name}" +description = "${mod_description}" +displayURL = "${mod_home_url}" +authors = "${mod_authors}" #logoFile = "" [[dependencies.mapsync]] modId = "forge" mandatory = true -versionRange = "[40,)" +versionRange = "[${forge_major_version},)" ordering = "NONE" side = "CLIENT" [[dependencies.mapsync]] modId = "minecraft" mandatory = true -versionRange = "[1.18.2,)" +versionRange = "[${minecraft_version},)" ordering = "NONE" side = "CLIENT" diff --git a/mod/forge/src/main/resources/mapsync.forge.mixins.json b/mod/forge/src/main/resources/mapsync.forge.mixins.json new file mode 100644 index 00000000..4792d957 --- /dev/null +++ b/mod/forge/src/main/resources/mapsync.forge.mixins.json @@ -0,0 +1,14 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "gjum.minecraft.mapsync.forge.mixins", + "compatibilityLevel": "JAVA_17", + "mixins": [], + "client": [ + + ], + "server": [], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/mod/forge/src/main/resources/pack.mcmeta b/mod/forge/src/main/resources/pack.mcmeta index e7a57a5c..0621a435 100644 --- a/mod/forge/src/main/resources/pack.mcmeta +++ b/mod/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "Map Sync", + "description": "${mod_display_name}", "pack_format": 6 } } diff --git a/mod/gradle.properties b/mod/gradle.properties index edc7870e..8d187eab 100644 --- a/mod/gradle.properties +++ b/mod/gradle.properties @@ -1,14 +1,22 @@ org.gradle.jvmargs=-Xmx2048M -archives_base_name=map-sync +archives_base_name=MapSync maven_group=gjum.minecraft.mapsync mod_version=2.0.1-1.18.2 +mod_display_name=MapSync +mod_description=Share map data with your friends, live, and privately. +mod_authors=Gjum,Protonull,okx,Huskydog9988,specificlanguage,SirAlador,klaribot +copyright_licence=GPLv3 +mod_home_url=https://github.com/CivPlatform/map-sync +mod_source_url=https://github.com/CivPlatform/map-sync +mod_issues_url=https://github.com/CivPlatform/map-sync/issues minecraft_version=1.18.2 enabled_platforms=fabric,forge # https://fabricmc.net/versions.html -fabric_loader_version=0.14.9 -fabric_api_version=0.58.0+1.18.2 +fabric_loader_version=0.15.10 +fabric_api_version=0.77.0+1.18.2 -forge_version=1.18.2-40.1.73 +forge_version=1.18.2-40.2.0 +forge_major_version=40 diff --git a/mod/settings.gradle b/mod/settings.gradle index 6cd13299..9ab08e8b 100644 --- a/mod/settings.gradle +++ b/mod/settings.gradle @@ -7,8 +7,8 @@ pluginManagement { } } -include("common") -include("fabric") -include("forge") +include(":common") +include(":fabric") +include(":forge") -rootProject.name = "map-sync" +rootProject.name = "MapSync"