diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e722bc4..22f2de9 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -9,7 +9,10 @@ jobs: build: if: | !contains(github.event.head_commit.message, '[ciskip]') - uses: nanite/workflows/.github/workflows/standard-arch-release.yml@v1 + uses: nanite/workflows/.github/workflows/release.yml@v1.2 + with: + gradle-tasks: 'build publish publishMods' secrets: nanite-token: ${{ secrets.NANITE_DEPLOY }} curse-token: ${{ secrets.CURSE_DEPLOY }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index b9dad1d..3e59a5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ -## [81.1.0] +## [82.0.0] ### Changed -- Ported to 1.20.1 +- Ported to 1.20.2 diff --git a/build.gradle b/build.gradle index 4ff8c61..bc67735 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { - id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false + id "architectury-plugin" version "3.4.151" + id "dev.architectury.loom" version "1.4.373" apply false + id "me.modmuss50.mod-publish-plugin" version "0.4.5" } architectury { @@ -51,6 +52,96 @@ allprojects { java { withSourcesJar() } + + publishing { + repositories { + if (ENV.NANITE_TOKEN) { + maven { + url "https://maven.nanite.dev/releases" + credentials { + username = "nanite" + password = "${ENV.NANITE_TOKEN}" + } + } + } + } + } } -task curseforgePublish +publishMods { + dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null + changelog = file("./CHANGELOG.md").text + version = "${mod_version}" + type = STABLE + + def fabricOptions = publishOptions { + file = project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "[FABRIC][${minecraft_version}] Default Server Properties ${mod_version}" + modLoaders.add("fabric") + } + + def forgeOptions = publishOptions { + file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "[FORGE][${minecraft_version}] Default Server Properties ${mod_version}" + modLoaders.add("forge") + } + + def neoForge = publishOptions { + file = project.provider { project(":neoforge").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "[NEOFORGE][${minecraft_version}] Default Server Properties ${mod_version}" + modLoaders.add("neoforge") + } + + def curseForgeOptions = curseforgeOptions { + accessToken = providers.environmentVariable("CURSE_TOKEN") + projectId = "${curseforge_id}" + minecraftVersions.add("${minecraft_version}") + } + + def modrinthOptions = modrinthOptions { + accessToken = providers.environmentVariable("MODRINTH_TOKEN") + projectId = "${modrinth_id}" + minecraftVersions.add("${minecraft_version}") + } + + curseforge("curseforgeFabric") { + from(curseForgeOptions, fabricOptions) + requires { + slug = "fabric-api" + } + } + + curseforge("curseforgeForge") { + from(curseForgeOptions, forgeOptions) + } + + curseforge("curseforgeNeoForge") { + from(curseForgeOptions, neoForge) + } + + modrinth("modrinthFabric") { + from(modrinthOptions, fabricOptions) + requires { + slug = "fabric-api" + } + } + + modrinth("modrinthForge") { + from(modrinthOptions, forgeOptions) + } + + modrinth("modrinthNeoforge") { + from(modrinthOptions, neoForge) + } + + github { + file = project.provider { project(":forge").tasks.remapJar }.flatMap { it.archiveFile } + additionalFiles.from project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile } + additionalFiles.from project.provider { project(":neoforge").tasks.remapJar }.flatMap { it.archiveFile } + + repository = "${project.github_repo}" + accessToken = providers.environmentVariable("GITHUB_TOKEN") + commitish = providers.environmentVariable("GITHUB_SHA").orElse("dryRun") + tagName = providers.environmentVariable("GITHUB_REF_NAME").orElse("dryRun") + } +} diff --git a/fabric/build.gradle b/fabric/build.gradle index 9aa7cc5..8d372cb 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,6 +1,5 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.2" - id "com.matthewprenger.cursegradle" version "1.4.0" } architectury { @@ -78,34 +77,4 @@ publishing { from components.java } } - - repositories { - if (ENV.NANITE_TOKEN) { - maven { - url "https://maven.nanite.dev/releases" - credentials { - username = "nanite" - password = "${ENV.NANITE_TOKEN}" - } - } - } - } -} - -if (ENV.CURSE_TOKEN) { - curseforge { - apiKey = ENV.CURSE_TOKEN - project { - id = rootProject.curseforge_id - releaseType = "beta" - addGameVersion "Fabric" - addGameVersion "Java 17" - addGameVersion "${rootProject.minecraft_version}" - mainArtifact(remapJar.getArchiveFile()) - changelog = file("./../CHANGELOG.md") - changelogType = 'markdown' - } - } } - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/forge/build.gradle b/forge/build.gradle index c2ae3d7..55cce56 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,6 +1,5 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.2" - id "com.matthewprenger.cursegradle" version "1.4.0" } architectury { @@ -29,7 +28,7 @@ configurations { } dependencies { - forge "net.minecraftforge:forge:${rootProject.forge_version}" + forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } @@ -88,34 +87,4 @@ publishing { from components.java } } - - repositories { - if (ENV.NANITE_TOKEN) { - maven { - url "https://maven.nanite.dev/releases" - credentials { - username = "nanite" - password = "${ENV.NANITE_TOKEN}" - } - } - } - } -} - -if (ENV.CURSE_TOKEN) { - curseforge { - apiKey = ENV.CURSE_TOKEN - project { - id = rootProject.curseforge_id - releaseType = "release" - addGameVersion "Forge" - addGameVersion "Java 17" - addGameVersion "${rootProject.minecraft_version}" - mainArtifact(remapJar.getArchiveFile()) - changelog = file("./../CHANGELOG.md") - changelogType = 'markdown' - } - } } - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/gradle.properties b/gradle.properties index 358f2b7..1f76871 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,19 @@ org.gradle.jvmargs=-Xmx2048M -minecraft_version=1.20.1 -enabled_platforms=fabric,forge +minecraft_version=1.20.2 +enabled_platforms=fabric,forge,neoforge archives_base_name=default-server-properties -mod_version=81.1.0 +mod_version=82.0.0 maven_group=dev.nanite.mods -fabric_loader_version=0.14.21 -fabric_api_version=0.83.1+1.20.1 +fabric_loader_version=0.15.3 +fabric_api_version=0.91.2+1.20.2 -forge_version=1.20.1-47.0.6 +forge_version=48.1.0 +neo_forge=20.2.86 curseforge_id=676811 +modrinth_id=Fnrzx9Jl +github_repo=nanite/Default-Server-Properties + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fae0804..a595206 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/neoforge/build.gradle b/neoforge/build.gradle new file mode 100644 index 0000000..9ee1bed --- /dev/null +++ b/neoforge/build.gradle @@ -0,0 +1,92 @@ +plugins { + id "com.github.johnrengelman.shadow" version "7.1.2" +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +repositories { + maven { + url "https://maven.saps.dev/mirror" + } +} + +loom { + accessWidenerPath = project(":common").loom.accessWidenerPath + neoForge { + + } +} + +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentNeoForge.extendsFrom common +} + +dependencies { + neoForge "net.neoforged:neoforge:${rootProject.neo_forge}" + + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false } +} + +processResources { + def forgeMajor = ((String) rootProject.forge_version).split("-").last().split("\\.").first() + inputs.properties([ + version: project.version, + mcversion: rootProject.minecraft_version, + forgemajor: forgeMajor + ]) + + filesMatching("META-INF/mods.toml") { + expand "version": project.version, + "mcversion": rootProject.minecraft_version, + "forgemajor": forgeMajor + } +} + +shadowJar { + exclude "fabric.mod.json" + exclude "architectury.common.json" + + configurations = [project.configurations.shadowCommon] + setArchiveClassifier("dev-shadow") +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + archiveBaseName.set "${rootProject.archives_base_name}-${project.name}" + setArchiveClassifier(null) + atAccessWideners.add('dsp.accesswidener') +} + +jar { + setArchiveClassifier("dev") +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +publishing { + publications { + mavenNeoForge(MavenPublication) { + artifactId = rootProject.archives_base_name + "-" + project.name + from components.java + } + } +} diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties new file mode 100644 index 0000000..7da18ea --- /dev/null +++ b/neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge diff --git a/neoforge/src/main/java/dev/nanite/dsp/neoforge/DSPExpectedPlatformImpl.java b/neoforge/src/main/java/dev/nanite/dsp/neoforge/DSPExpectedPlatformImpl.java new file mode 100644 index 0000000..ce8c469 --- /dev/null +++ b/neoforge/src/main/java/dev/nanite/dsp/neoforge/DSPExpectedPlatformImpl.java @@ -0,0 +1,11 @@ +package dev.nanite.dsp.neoforge; + +import net.neoforged.fml.loading.FMLPaths; + +import java.nio.file.Path; + +public class DSPExpectedPlatformImpl { + public static Path getGameDir() { + return FMLPaths.GAMEDIR.get(); + } +} diff --git a/neoforge/src/main/java/dev/nanite/dsp/neoforge/DSPModNeoforge.java b/neoforge/src/main/java/dev/nanite/dsp/neoforge/DSPModNeoforge.java new file mode 100644 index 0000000..6b92055 --- /dev/null +++ b/neoforge/src/main/java/dev/nanite/dsp/neoforge/DSPModNeoforge.java @@ -0,0 +1,11 @@ +package dev.nanite.dsp.neoforge; + +import dev.nanite.dsp.DSPMod; +import net.neoforged.fml.common.Mod; + +@Mod(DSPMod.MOD_ID) +public class DSPModNeoforge { + public DSPModNeoforge() { + DSPMod.init(); + } +} diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..879a457 --- /dev/null +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,35 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +license = "Mozilla Public License 2.0" +issueTrackerURL="https://github.com/nanite/Default-Server-Properties/issues" + +[[mods]] +modId = "dsp" +version = "${version}" +authors = "ErrorMikey" +credits = "Nanite Team" +displayName = "Default Server Properties" +description = ''' +Simple mod that allows modpack developers to define a default server properties file. This is typically used for settings like the default_level_type. +''' +displayTest="IGNORE_ALL_VERSION" + +[[dependencies.dsp]] +modId = "neoforge" +mandatory = true +versionRange = "[20.2,)" +ordering = "NONE" +side = "SERVER" + +[[dependencies.dsp]] +modId = "minecraft" +mandatory = true +versionRange = "[1.20.2,)" +ordering = "NONE" +side = "SERVER" + +[[mixins]] +config = "dsp-common.mixins.json" + +[[mixins]] +config = "dsp.mixins.json" diff --git a/neoforge/src/main/resources/dsp.mixins.json b/neoforge/src/main/resources/dsp.mixins.json new file mode 100644 index 0000000..edd3fc7 --- /dev/null +++ b/neoforge/src/main/resources/dsp.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "package": "dev.nanite.dsp.mixin.forge", + "compatibilityLevel": "JAVA_17", + "minVersion": "0.8", + "client": [ + ], + "mixins": [ + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..13bddd4 --- /dev/null +++ b/neoforge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "DSP Mod", + "pack_format": 8 + } +} diff --git a/settings.gradle b/settings.gradle index 70759f3..e03c01c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,14 +1,14 @@ pluginManagement { repositories { + maven { url "https://maven.saps.dev/mirror"} maven { url "https://maven.fabricmc.net/" } maven { url "https://maven.architectury.dev/" } maven { url "https://maven.minecraftforge.net/" } + maven { url "https://maven.neoforged.net/releases" } gradlePluginPortal() } } -include("common") -include("fabric") -include("forge") +include "common", "fabric", "forge", "neoforge" rootProject.name = "dsp"