From d49ca10c819b4d85b1b23ff57d3dd0ea663098d9 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Mon, 17 Jun 2024 17:11:58 +0100 Subject: [PATCH 1/2] chore: ported to MC 1.21 Moved to using MPP publishing --- .github/workflows/release.yml | 2 +- build.gradle | 84 ++++++++++++++++++- common/build.gradle | 22 ----- .../ftbxmodcompat/ftbquests/QuestItems.java | 4 +- .../jei/FTBQuestsJEIIntegration.java | 2 +- .../ftbquests/jei/QuestCategory.java | 2 +- fabric/build.gradle | 49 ----------- .../FTBChunksProtectionProvider.java | 2 +- forge/build.gradle | 49 ----------- gradle.properties | 43 +++++----- neoforge/build.gradle | 52 +----------- settings.gradle | 2 +- 12 files changed, 112 insertions(+), 201 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 715eb75..5d42e34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: !contains(github.event.head_commit.message, '[ciskip]') uses: FTBTeam/mods-meta/.github/workflows/standard-release.yml@main with: - curse-publish-task: curseforge + curse-publish-task: publishMods java-version: 21 secrets: ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }} diff --git a/build.gradle b/build.gradle index 7846418..8cbd171 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.6-SNAPSHOT" apply false + id "me.modmuss50.mod-publish-plugin" version "0.5.1" } architectury { @@ -81,7 +82,7 @@ allprojects { } } - tasks.withType(JavaCompile) { + tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" options.release = 21 } @@ -89,6 +90,85 @@ allprojects { java { withSourcesJar() } + + publishing { + repositories { + if (ftbPublishing.ftbToken) { + maven { + url ftbPublishing.ftbURL + credentials { + username = ftbPublishing.ftbUser + password = ftbPublishing.ftbToken + } + } + } + + if (ftbPublishing.sapsToken) { + maven { + url ftbPublishing.sapsURL + credentials { + username = ftbPublishing.sapsUser + password = ftbPublishing.sapsToken + } + } + } + } + } } -task curseforgePublish +publishMods { + dryRun = providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null + changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided") + version = "${mod_version}" + + // TODO: Migrate to something else + def tag = providers.environmentVariable("TAG").getOrElse("release") + type = tag == "beta" ? BETA : (tag == "alpha" ? ALPHA : STABLE) + + def createOptions = (String projectName) -> { + publishOptions { + file = project.provider { project(":$projectName").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "[${projectName.toUpperCase()}][${minecraft_version}] ${readable_name} ${mod_version}" + modLoaders.add(projectName.toLowerCase()) + } + } + + def fabricOptions = createOptions("fabric") + def neoForgeOptions = createOptions("neoforge") +// def forgeOptions = createOptions("forge") + + def curseForgeOptions = curseforgeOptions { + accessToken = providers.environmentVariable("CURSEFORGE_KEY") + projectId = curseforge_id + minecraftVersions.add("${minecraft_version}") + requires('architectury-api') + optional('jei') + optional('roughly-enough-items') + } + + curseforge("curseforgeFabric") { + from(curseForgeOptions, fabricOptions) + requires('fabric-api') + requires('ftb-library-fabric') + optional('ftb-quests-fabric') + optional('ftb-ranks-fabric') + optional('waystones-fabric') + } + + curseforge("curseforgeNeoForge") { + from(curseForgeOptions, neoForgeOptions) + requires('ftb-library-neoforge') + optional('ftb-quests-neoforge') + optional('ftb-ranks-neoforge') + optional('waystones') + optional('kubejs') + } + +// curseforge("curseforgeForge") { +// from(curseForgeOptions, forgeOptions) +// requires('ftb-library-forge') +// optional('ftb-quests-forge') +// optional('ftb-ranks-forge') +// optional('waystones') +// } +} diff --git a/common/build.gradle b/common/build.gradle index 43815a5..e46a43b 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -37,26 +37,4 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/QuestItems.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/QuestItems.java index 54c655c..8a6c844 100644 --- a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/QuestItems.java +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/QuestItems.java @@ -7,8 +7,8 @@ import net.minecraft.world.item.Item; public class QuestItems { - private static final ResourceKey QUEST_BOOK = ResourceKey.create(Registries.ITEM, new ResourceLocation("ftbquests:book")); - private static final ResourceKey LOOT_CRATE = ResourceKey.create(Registries.ITEM, new ResourceLocation("ftbquests:lootcrate")); + private static final ResourceKey QUEST_BOOK = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("ftbquests:book")); + private static final ResourceKey LOOT_CRATE = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("ftbquests:lootcrate")); private static Item questBook; private static Item lootCrate; diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/FTBQuestsJEIIntegration.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/FTBQuestsJEIIntegration.java index edbf736..aeb67e9 100644 --- a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/FTBQuestsJEIIntegration.java +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/FTBQuestsJEIIntegration.java @@ -18,7 +18,7 @@ @JeiPlugin public class FTBQuestsJEIIntegration implements IModPlugin { - private static final ResourceLocation UID = new ResourceLocation(FTBXModCompat.MOD_ID, "ftbquests_jei"); + private static final ResourceLocation UID = ResourceLocation.fromNamespaceAndPath(FTBXModCompat.MOD_ID, "ftbquests_jei"); public static IJeiRuntime runtime; @Override diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/QuestCategory.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/QuestCategory.java index 657f4f0..622ae06 100644 --- a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/QuestCategory.java +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/jei/QuestCategory.java @@ -22,7 +22,7 @@ import net.minecraft.world.item.ItemStack; public class QuestCategory implements IRecipeCategory { - public static final ResourceLocation TEXTURE = new ResourceLocation(FTBQuestsAPI.MOD_ID + ":textures/gui/jei/quest.png"); + public static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(FTBQuestsAPI.MOD_ID, "textures/gui/jei/quest.png"); private final IDrawable background; private final IDrawable icon; diff --git a/fabric/build.gradle b/fabric/build.gradle index b2d370d..9359148 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -117,53 +117,4 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } - -if (ENV.CURSEFORGE_KEY) { - curseforge { - apiKey = ENV.CURSEFORGE_KEY - project { - id = project.curseforge_id - releaseType = ftbPublishing.relType - addGameVersion "Fabric" - addGameVersion project.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-fabric' - optionalDependency 'ftb-quests-fabric' - optionalDependency 'ftb-ranks-fabric' - optionalDependency 'kubejs' - optionalDependency 'jei' - optionalDependency 'roughly-enough-items' - optionalDependency 'waystones-fabric' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does - changelogType = 'markdown' - } - } -} - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/fabric/src/main/java/dev/ftb/mods/ftbxmodcompat/fabric/ftbchunks/commonprot/FTBChunksProtectionProvider.java b/fabric/src/main/java/dev/ftb/mods/ftbxmodcompat/fabric/ftbchunks/commonprot/FTBChunksProtectionProvider.java index e1bcc82..50c513b 100644 --- a/fabric/src/main/java/dev/ftb/mods/ftbxmodcompat/fabric/ftbchunks/commonprot/FTBChunksProtectionProvider.java +++ b/fabric/src/main/java/dev/ftb/mods/ftbxmodcompat/fabric/ftbchunks/commonprot/FTBChunksProtectionProvider.java @@ -32,7 +32,7 @@ import java.util.concurrent.TimeUnit; public class FTBChunksProtectionProvider implements ProtectionProvider { - public static ResourceLocation ID = new ResourceLocation(FTBChunks.MOD_ID, "provider"); + public static ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(FTBChunks.MOD_ID, "provider"); private static LoadingCache FAKE_PLAYERS = null; public static void init() { diff --git a/forge/build.gradle b/forge/build.gradle index 19c5694..5ad9e45 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -103,54 +103,5 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } -} - -if (ENV.CURSEFORGE_KEY) { - curseforge { - apiKey = ENV.CURSEFORGE_KEY - project { - id = project.curseforge_id - releaseType = ftbPublishing.relType - addGameVersion "Forge" - addGameVersion project.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-forge' - optionalDependency 'ftb-quests-forge' - optionalDependency 'ftb-ranks-forge' - optionalDependency 'kubejs' - optionalDependency 'jei' - optionalDependency 'roughly-enough-items' - optionalDependency 'game-stages' - optionalDependency 'waystones' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does - changelogType = 'markdown' - } - } } -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/gradle.properties b/gradle.properties index f02abd2..4ab6fdb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,39 +1,40 @@ org.gradle.jvmargs=-Xmx2048M -minecraft_version=1.20.6 +minecraft_version=1.21 #enabled_platforms=fabric,forge,neoforge enabled_platforms=fabric,neoforge archives_base_name=ftb-xmod-compat -mod_version=3.1.0 +readable_name=FTB XMod Compat +mod_version=3.2.0 maven_group=dev.ftb.mods curseforge_id=889915 forge_version=50.0.9 -neoforge_version=20.6.100-beta -neoforge_loader_version=1 -fabric_loader_version=0.15.10 -fabric_api_version=0.97.8+1.20.6 +neoforge_version=21.0.14-beta +neoforge_loader_version=4 +fabric_loader_version=0.15.11 +fabric_api_version=0.100.1+1.21 -architectury_version=12.1.3 +architectury_version=13.0.1 -ftb_library_version=2006.1.1 -ftb_quests_version=2006.1.0-SNAPSHOT -ftb_chunks_version=2006.1.0 -ftb_ranks_version=2006.1.0 -ftb_essentials_version=2006.1.0 -ftb_teams_version=2006.1.0 -ftb_filter_system_version=2.1.0 +ftb_library_version=2100.1.0-SNAPSHOT +ftb_quests_version=2100.1.0-SNAPSHOT +ftb_chunks_version=2100.1.0-SNAPSHOT +ftb_ranks_version=2100.1.0-SNAPSHOT +ftb_essentials_version=2100.1.0-SNAPSHOT +ftb_teams_version=2100.1.0-SNAPSHOT +ftb_filter_system_version=3.0.0-SNAPSHOT -rei_version=15.0.728 +rei_version=16.0.729 common_prot_api_version=1.0.0 luckperms_api_version=5.4 -waystones_neoforge_version=5389804 -waystones_forge_version=5389798 -waystones_fabric_version=5389793 -balm_neoforge_version=5389055 -balm_forge_version=5389054 -balm_fabric_version=5389051 +waystones_neoforge_version=5427156 +waystones_forge_version=5427151 +waystones_fabric_version=5427150 +balm_neoforge_version=5438018 +balm_forge_version=5438000 +balm_fabric_version=5437997 # TODO compiling against 1.20.4 version for now jei_version=17.3.0.49 diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 43abb6b..05d65d2 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -107,60 +107,10 @@ components.java { publishing { publications { - mavenForge(MavenPublication) { + mavenNeoForge(MavenPublication) { artifactId = "${rootProject.archives_base_name}-${project.name}" version ftbPublishing.mavenVersion from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } - -if (ENV.CURSEFORGE_KEY) { - curseforge { - apiKey = ENV.CURSEFORGE_KEY - project { - id = project.curseforge_id - releaseType = ftbPublishing.relType - addGameVersion "NeoForge" - addGameVersion project.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-forge' - optionalDependency 'ftb-quests-forge' - optionalDependency 'ftb-ranks-forge' - optionalDependency 'kubejs' - optionalDependency 'jei' - optionalDependency 'roughly-enough-items' - optionalDependency 'game-stages' - optionalDependency 'waystones' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does - changelogType = 'markdown' - } - } -} - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/settings.gradle b/settings.gradle index 7ebb5d3..08105bd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,4 +12,4 @@ include("fabric") //include("forge") include("neoforge") -rootProject.name = "FTB-XMod-Compat-1.20.6" +rootProject.name = "FTB-XMod-Compat-1.21" From 9d61db036a85af2c21f62ce3026f55892dea317f Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Tue, 25 Jun 2024 08:12:05 +0100 Subject: [PATCH 2/2] build: updated dep versions & changelog --- CHANGELOG.md | 6 ++++++ common/build.gradle | 2 +- fabric/build.gradle | 2 +- gradle.properties | 16 ++++++++-------- neoforge/build.gradle | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc3176..cf71673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.2.0] + +### Changed +* Ported to Minecraft 1.21. Support for Fabric and NeoForge. + * Forge support may be re-added if/when Architectury adds support for Forge + ## [3.1.0] ### Changed diff --git a/common/build.gradle b/common/build.gradle index e46a43b..eff0154 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -22,7 +22,7 @@ dependencies { modApi("dev.ftb.mods:ftb-filter-system:${rootProject.ftb_filter_system_version}") modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:${rootProject.rei_version}") - modCompileOnly("mezz.jei:jei-1.20.4-common-api:${rootProject.jei_version}") + modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-common-api:${rootProject.jei_version}") compileOnly("net.luckperms:api:${rootProject.luckperms_api_version}") diff --git a/fabric/build.gradle b/fabric/build.gradle index 9359148..bce94eb 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -111,7 +111,7 @@ components.java { publishing { publications { - mavenForge(MavenPublication) { + mavenFabric(MavenPublication) { artifactId = "${rootProject.archives_base_name}-${project.name}" version ftbPublishing.mavenVersion from components.java diff --git a/gradle.properties b/gradle.properties index 4ab6fdb..76e8ca7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,13 +18,13 @@ fabric_api_version=0.100.1+1.21 architectury_version=13.0.1 -ftb_library_version=2100.1.0-SNAPSHOT -ftb_quests_version=2100.1.0-SNAPSHOT -ftb_chunks_version=2100.1.0-SNAPSHOT -ftb_ranks_version=2100.1.0-SNAPSHOT -ftb_essentials_version=2100.1.0-SNAPSHOT -ftb_teams_version=2100.1.0-SNAPSHOT -ftb_filter_system_version=3.0.0-SNAPSHOT +ftb_library_version=2100.1.1 +ftb_quests_version=2100.1.1 +ftb_chunks_version=2100.1.0 +ftb_ranks_version=2100.1.0 +ftb_essentials_version=2100.1.0 +ftb_teams_version=2100.1.0 +ftb_filter_system_version=3.0.0 rei_version=16.0.729 common_prot_api_version=1.0.0 @@ -35,8 +35,8 @@ waystones_fabric_version=5427150 balm_neoforge_version=5438018 balm_forge_version=5438000 balm_fabric_version=5437997 +jei_version=19.0.0.11 # TODO compiling against 1.20.4 version for now -jei_version=17.3.0.49 kubejs_version=2004.7.0-build.16 gamestages_version=15.0.1 diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 05d65d2..d500d83 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -49,7 +49,7 @@ dependencies { modCompileOnly("curse.maven:balm-531761:${balm_neoforge_version}") modCompileOnly("curse.maven:waystones-245755:${waystones_neoforge_version}") - modCompileOnly("mezz.jei:jei-1.20.4-forge-api:${rootProject.jei_version}") + modCompileOnly("mezz.jei:jei-${rootProject.minecraft_version}-forge-api:${rootProject.jei_version}") common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }