diff --git a/build.gradle b/build.gradle index 227d892..80fa4f4 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 { @@ -72,6 +73,78 @@ 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 forgeOptions = createOptions("forge") + def neoForgeOptions = createOptions("neoforge") + + def curseForgeOptions = curseforgeOptions { + accessToken = providers.environmentVariable("CURSEFORGE_KEY") + minecraftVersions.add("${minecraft_version}") + javaVersions.add(JavaVersion.VERSION_21) + } + + curseforge("curseforgeFabric") { + from(curseForgeOptions, fabricOptions) + projectId = curseforge_id_fabric + requires('architectury-api') + requires('fabric-api') + requires('ftb-library-fabric') + } + + curseforge("curseforgeNeoForge") { + from(curseForgeOptions, neoForgeOptions) + projectId = curseforge_id_forge + requires('architectury-api') + requires('ftb-library-forge') + } + +// curseforge("curseforgeForge") { +// from(curseForgeOptions, forgeOptions) +// projectId = curseforge_id_forge +// requires('architectury-api') +// requires('ftb-library-forge') +// } +} diff --git a/common/build.gradle b/common/build.gradle index 605855b..6cbddaf 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,13 +1,11 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modApi "dev.architectury:architectury:${rootProject.architectury_version}" + modApi "dev.architectury:architectury:${rootProject.architectury_api_version}" modApi "dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}" } -def ENV = System.getenv() - architectury { common(/*"forge",*/ "fabric", "neoforge") } @@ -20,26 +18,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/ftbteams/api/FTBTeamsAPI.java b/common/src/main/java/dev/ftb/mods/ftbteams/api/FTBTeamsAPI.java index 0765207..000cbb5 100644 --- a/common/src/main/java/dev/ftb/mods/ftbteams/api/FTBTeamsAPI.java +++ b/common/src/main/java/dev/ftb/mods/ftbteams/api/FTBTeamsAPI.java @@ -34,7 +34,7 @@ public static FTBTeamsAPI.API api() { * @return a new resource location */ public static ResourceLocation rl(String path) { - return new ResourceLocation(MOD_ID, path); + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); } /** @@ -121,4 +121,4 @@ public interface API { TeamMessage createMessage(UUID sender, Component text); } -} \ No newline at end of file +} diff --git a/common/src/main/java/dev/ftb/mods/ftbteams/client/FTBTeamsClient.java b/common/src/main/java/dev/ftb/mods/ftbteams/client/FTBTeamsClient.java index 2a351c7..c5b7762 100644 --- a/common/src/main/java/dev/ftb/mods/ftbteams/client/FTBTeamsClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbteams/client/FTBTeamsClient.java @@ -22,7 +22,7 @@ import java.util.UUID; public class FTBTeamsClient { - public static final ResourceLocation OPEN_GUI_ID = new ResourceLocation(FTBTeamsAPI.MOD_ID, "open_gui"); + public static final ResourceLocation OPEN_GUI_ID = FTBTeamsAPI.rl("open_gui"); public static KeyMapping openTeamsKey; diff --git a/common/src/main/java/dev/ftb/mods/ftbteams/data/TeamPropertyCollectionImpl.java b/common/src/main/java/dev/ftb/mods/ftbteams/data/TeamPropertyCollectionImpl.java index 3a6af5b..b92509b 100644 --- a/common/src/main/java/dev/ftb/mods/ftbteams/data/TeamPropertyCollectionImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbteams/data/TeamPropertyCollectionImpl.java @@ -167,7 +167,7 @@ void forEachProperty(BiConsumer, TeamPropertyValue> consu Optional> findProperty(String key) { try { - return Optional.ofNullable(byId.get(new ResourceLocation(key))); + return Optional.ofNullable(byId.get(ResourceLocation.tryParse(key))); } catch (ResourceLocationException e) { return Optional.empty(); } diff --git a/fabric/build.gradle b/fabric/build.gradle index f5aa074..7d371dd 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,10 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.0" - id "com.matthewprenger.cursegradle" version "1.4.0" } -def ENV = System.getenv() - configurations { shadowCommon } @@ -26,7 +23,7 @@ dependencies { modApi "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-fabric:${rootProject.architectury_api_version}" modApi("dev.ftb.mods:ftb-library-fabric:${rootProject.ftb_library_version}") { transitive false } //modRuntime("dev.ftb.mods:ftb-chunks-fabric:${rootProject.ftb_chunks_version}") { transitive false } @@ -40,7 +37,7 @@ processResources { filesMatching("fabric.mod.json") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "fabricapiversion": project.fabric_api_version, "mcversion": project.minecraft_version, "ftblibraryversion": project.ftb_library_version @@ -77,48 +74,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_fabric - releaseType = ftbPublishing.relType - addGameVersion "Fabric" - addGameVersion rootProject.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'fabric-api' - requiredDependency 'ftb-library-fabric' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE does - changelogType = 'markdown' - } - } -} - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/fabric/src/main/java/dev/ftb/mods/ftbteams/fabric/FTBTeamsFabric.java b/fabric/src/main/java/dev/ftb/mods/ftbteams/fabric/FTBTeamsFabric.java index ea92f8a..d2a0253 100644 --- a/fabric/src/main/java/dev/ftb/mods/ftbteams/fabric/FTBTeamsFabric.java +++ b/fabric/src/main/java/dev/ftb/mods/ftbteams/fabric/FTBTeamsFabric.java @@ -6,14 +6,13 @@ import dev.ftb.mods.ftbteams.data.TeamArgument; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry; -import net.minecraft.resources.ResourceLocation; public class FTBTeamsFabric implements ModInitializer { @Override public void onInitialize() { new FTBTeams().setup(); - ArgumentTypeRegistry.registerArgumentType(new ResourceLocation(FTBTeamsAPI.MOD_ID, "team"), TeamArgument.class, new TeamArgument.Info()); - ArgumentTypeRegistry.registerArgumentType(new ResourceLocation(FTBTeamsAPI.MOD_ID, "team_property"), TeamPropertyArgument.class, new TeamPropertyArgument.Info()); + ArgumentTypeRegistry.registerArgumentType(FTBTeamsAPI.rl("team"), TeamArgument.class, new TeamArgument.Info()); + ArgumentTypeRegistry.registerArgumentType(FTBTeamsAPI.rl("team_property"), TeamPropertyArgument.class, new TeamPropertyArgument.Info()); } } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index a5e082e..f608c36 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -19,7 +19,7 @@ }, "depends": { "fabric": ">=${fabricapiversion}", - "minecraft": "~1.20", + "minecraft": "~1.21", "architectury": ">=${archversion}", "ftblibrary": ">=${ftblibraryversion}" } diff --git a/forge/build.gradle b/forge/build.gradle index 0bd637e..9b15779 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,6 +1,5 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.0" - id "com.matthewprenger.cursegradle" version "1.4.0" } def ENV = System.getenv() @@ -21,7 +20,7 @@ configurations { dependencies { forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" - modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-forge:${rootProject.architectury_api_version}" modApi("dev.ftb.mods:ftb-library-forge:${rootProject.ftb_library_version}") { transitive false } common(project(path: ":common", configuration: "namedElements")) { transitive false } @@ -35,7 +34,7 @@ processResources { filesMatching("META-INF/mods.toml") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "forgeversion": project.forge_version, "forgeshortversion": project.forge_version.split("\\.")[0], "mcversion": project.minecraft_version, @@ -94,47 +93,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_forge - releaseType = ftbPublishing.relType - addGameVersion "Forge" - addGameVersion rootProject.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-forge' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE does - changelogType = 'markdown' - } - } -} - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/gradle.properties b/gradle.properties index ed41eaa..b57f9de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,26 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false + mod_id=ftbteams archives_base_name=ftb-teams maven_group=dev.ftb.mods -mod_version=2006.1.0 +readable_name=FTB Teams mod_author=FTB Team -minecraft_version=1.20.6 + +mod_version=2100.1.0 +minecraft_version=1.21 # Deps -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.99.0+1.20.6 -architectury_version=12.1.3 +#forge_version=50.0.9 +neoforge_version=21.0.10-beta + +# https://maven.neoforged.net/#/releases/net/neoforged/fancymodloader/loader +neoforge_loader_version=4 +fabric_loader_version=0.15.11 +fabric_api_version=0.100.1+1.21 +architectury_api_version=13.0.1 -ftb_library_version=2006.1.1 +ftb_library_version=2100.1.0-SNAPSHOT curseforge_id_forge=404468 curseforge_id_fabric=438497 diff --git a/neoforge/build.gradle b/neoforge/build.gradle index 15887e7..9499aa4 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -1,10 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.0" - id "com.matthewprenger.cursegradle" version "1.4.0" } -def ENV = System.getenv() - architectury { platformSetupLoomIde() neoForge() @@ -27,7 +24,7 @@ repositories { dependencies { neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" - modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_api_version}" modApi("dev.ftb.mods:ftb-library-neoforge:${rootProject.ftb_library_version}") { transitive false } common(project(path: ":common", configuration: "namedElements")) { transitive false } @@ -41,7 +38,7 @@ processResources { filesMatching("META-INF/neoforge.mods.toml") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "neoforgeversion": project.neoforge_version, "neoforgeloaderversion": project.neoforge_loader_version, "mcversion": project.minecraft_version, @@ -93,47 +90,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_forge - releaseType = ftbPublishing.relType - addGameVersion "NeoForge" - addGameVersion rootProject.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-forge' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE does - changelogType = 'markdown' - } - } -} - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/settings.gradle b/settings.gradle index 0bf34af..5f5d0a4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,4 +8,4 @@ pluginManagement { include "common", "fabric", /*"forge",*/ "neoforge" -rootProject.name = 'FTB-Teams-1.20.6' +rootProject.name = 'FTB-Teams-1.21'