Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to 1.21 #52

Merged
merged 4 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

## [2006.1.0]

### Changed
* Ported to Minecraft 1.20.6. Support for Fabric and NeoForge.
* Forge support may be re-added if/when Architectury adds support for Forge

## [2004.1.2]

### Changed
Expand Down
75 changes: 74 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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')
// }
}
26 changes: 1 addition & 25 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -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")
}
Expand All @@ -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
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -121,4 +121,4 @@ public interface API {

TeamMessage createMessage(UUID sender, Component text);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ <T> void forEachProperty(BiConsumer<TeamProperty<T>, TeamPropertyValue<T>> consu

Optional<TeamProperty<?>> 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();
}
Expand Down
51 changes: 2 additions & 49 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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 }
Expand All @@ -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
Expand Down Expand Up @@ -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")
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"depends": {
"fabric": ">=${fabricapiversion}",
"minecraft": "~1.20",
"minecraft": "~${mcversion}",
"architectury": ">=${archversion}",
"ftblibrary": ">=${ftblibraryversion}"
}
Expand Down
48 changes: 2 additions & 46 deletions forge/build.gradle
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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 }
Expand All @@ -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,
Expand Down Expand Up @@ -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")
23 changes: 14 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading