aboutsummaryrefslogtreecommitdiff
path: root/forge
diff options
context:
space:
mode:
authorXander <xander@isxander.dev>2023-04-25 16:28:41 +0100
committerGitHub <noreply@github.com>2023-04-25 16:28:41 +0100
commit13c7ba45ff201423eb8dba8a40cfb66ebb531439 (patch)
tree1e799aa9da11fbc0833bc6b7c6e6799633c2ec50 /forge
parent8ba7196ae990fe9aa98680aba1b387e385fff99c (diff)
downloadYetAnotherConfigLib-13c7ba45ff201423eb8dba8a40cfb66ebb531439.tar.gz
YetAnotherConfigLib-13c7ba45ff201423eb8dba8a40cfb66ebb531439.tar.bz2
YetAnotherConfigLib-13c7ba45ff201423eb8dba8a40cfb66ebb531439.zip
Architectury! (#61)
Diffstat (limited to 'forge')
-rw-r--r--forge/.gitignore42
-rw-r--r--forge/build.gradle.kts164
-rw-r--r--forge/gradle.properties1
-rw-r--r--forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java11
-rw-r--r--forge/src/main/resources/META-INF/mods.toml28
-rw-r--r--forge/src/main/resources/pack.mcmeta6
6 files changed, 252 insertions, 0 deletions
diff --git a/forge/.gitignore b/forge/.gitignore
new file mode 100644
index 0000000..b63da45
--- /dev/null
+++ b/forge/.gitignore
@@ -0,0 +1,42 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store \ No newline at end of file
diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts
new file mode 100644
index 0000000..5ba9450
--- /dev/null
+++ b/forge/build.gradle.kts
@@ -0,0 +1,164 @@
+import org.gradle.jvm.tasks.Jar
+
+plugins {
+ alias(libs.plugins.architectury.loom)
+ alias(libs.plugins.shadow)
+ alias(libs.plugins.unified.publishing)
+}
+
+architectury {
+ platformSetupLoomIde()
+ forge()
+}
+
+loom {
+ silentMojangMappingsLicense()
+
+ accessWidenerPath.set(project(":common").loom.accessWidenerPath)
+
+ forge {
+ mixinConfig("yacl.mixins.json")
+
+ convertAccessWideners.set(true)
+ extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
+ }
+}
+
+val common by configurations.registering
+val shadowCommon by configurations.registering
+configurations.compileClasspath.get().extendsFrom(common.get())
+configurations["developmentForge"].extendsFrom(common.get())
+
+val minecraftVersion: String = libs.versions.minecraft.get()
+
+dependencies {
+ minecraft(libs.minecraft)
+ mappings(loom.layered {
+ mappings("org.quiltmc:quilt-mappings:$minecraftVersion+build.${libs.versions.quilt.mappings.get()}:intermediary-v2")
+ officialMojangMappings()
+ })
+ forge(libs.forge)
+
+ "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false }
+ "shadowCommon"(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false }
+}
+
+java {
+ withSourcesJar()
+}
+
+tasks {
+ processResources {
+ val modId: String by rootProject
+ val modName: String by rootProject
+ val modDescription: String by rootProject
+ val githubProject: String by rootProject
+ val majorForge = libs.versions.forge.get().substringAfter('-').split('.').first()
+
+ inputs.property("id", modId)
+ inputs.property("group", project.group)
+ inputs.property("name", modName)
+ inputs.property("description", modDescription)
+ inputs.property("version", project.version)
+ inputs.property("github", githubProject)
+ inputs.property("major_forge", majorForge)
+
+ filesMatching(listOf("META-INF/mods.toml", "pack.mcmeta")) {
+ expand(
+ "id" to modId,
+ "group" to project.group,
+ "name" to modName,
+ "description" to modDescription,
+ "version" to project.version,
+ "github" to githubProject,
+ "major_forge" to majorForge,
+ )
+ }
+ }
+
+ shadowJar {
+ exclude("fabric.mod.json")
+ exclude("architectury.common.json")
+
+ configurations = listOf(shadowCommon.get())
+ archiveClassifier.set("dev-shadow")
+ }
+
+ remapJar {
+ injectAccessWidener.set(true)
+ inputFile.set(shadowJar.get().archiveFile)
+ dependsOn(shadowJar)
+ archiveClassifier.set(null as String?)
+
+ from(rootProject.file("LICENSE"))
+ }
+
+ named<Jar>("sourcesJar") {
+ archiveClassifier.set("dev-sources")
+ val commonSources = project(":common").tasks.named<Jar>("sourcesJar")
+ dependsOn(commonSources)
+ from(commonSources.get().archiveFile.map { zipTree(it) })
+ }
+
+ remapSourcesJar {
+ archiveClassifier.set("sources")
+ }
+
+ jar {
+ archiveClassifier.set("dev")
+ }
+}
+
+components["java"].withGroovyBuilder {
+ "withVariantsFromConfiguration"(configurations["shadowRuntimeElements"]) {
+ "skip"()
+ }
+}
+
+val changelogText: String by ext
+
+unifiedPublishing {
+ project {
+ displayName.set("${project.version} (Forge)")
+ releaseType.set("release")
+ gameVersions.set(listOf("1.19.3", "1.19.4"))
+ gameLoaders.set(listOf("forge"))
+ changelog.set(changelogText)
+
+ mainPublication(tasks.remapJar.get())
+ secondaryPublication(tasks.remapSourcesJar.get().archiveFile)
+
+ val modrinthId: String? by rootProject
+ if (modrinthId?.isNotEmpty() == true) {
+ modrinth {
+ token.set(findProperty("modrinth.token")?.toString() ?: "Modrinth publishing token not found")
+ id.set(modrinthId)
+ version.set("${project.version}-forge")
+ }
+ }
+
+ val curseforgeId: String? by rootProject
+ if (curseforgeId?.isNotEmpty() == true) {
+ curseforge {
+ token.set(findProperty("curseforge.token")?.toString() ?: "Curseforge publishing token not found")
+ id.set(curseforgeId)
+ gameVersions.add("Java 17")
+ }
+ }
+ }
+}
+rootProject.tasks["releaseMod"].dependsOn(tasks["publishUnified"])
+
+publishing {
+ publications {
+ create<MavenPublication>("forge") {
+ groupId = "dev.isxander.yacl"
+ artifactId = "yet-another-config-lib-forge"
+
+ from(components["java"])
+ }
+ }
+}
+tasks.findByPath("publishForgePublicationToReleasesRepository")?.let {
+ rootProject.tasks["releaseMod"].dependsOn(it)
+}
diff --git a/forge/gradle.properties b/forge/gradle.properties
new file mode 100644
index 0000000..32f842a
--- /dev/null
+++ b/forge/gradle.properties
@@ -0,0 +1 @@
+loom.platform=forge \ No newline at end of file
diff --git a/forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java b/forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java
new file mode 100644
index 0000000..3360184
--- /dev/null
+++ b/forge/src/main/java/dev/isxander/yacl/forge/YACLForgeEntrypoint.java
@@ -0,0 +1,11 @@
+package dev.isxander.yacl.forge;
+
+import net.minecraftforge.fml.common.Mod;
+
+@Mod("yet_another_config_lib")
+public class YACLForgeEntrypoint {
+ public YACLForgeEntrypoint() {
+
+ }
+
+}
diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml
new file mode 100644
index 0000000..e6a0a07
--- /dev/null
+++ b/forge/src/main/resources/META-INF/mods.toml
@@ -0,0 +1,28 @@
+modLoader = "javafml"
+loaderVersion = "[${major_forge},)"
+#issueTrackerURL = ""
+license = "LGPL-3.0-or-later"
+
+[[mods]]
+modId = "${id}"
+version = "${version}"
+displayName = "${name}"
+authors = "isXander"
+description = '''
+${description}
+'''
+logoFile = "yacl-128x.png"
+
+[["dependencies.${id}"]]
+modId = "forge"
+mandatory = true
+versionRange = "[${major_forge},)"
+ordering = "NONE"
+side = "BOTH"
+
+[["dependencies.${id}"]]
+modId = "minecraft"
+mandatory = true
+versionRange = "[1.19.4,)"
+ordering = "NONE"
+side = "BOTH"
diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta
new file mode 100644
index 0000000..a9c6340
--- /dev/null
+++ b/forge/src/main/resources/pack.mcmeta
@@ -0,0 +1,6 @@
+{
+ "pack": {
+ "description": "${name}",
+ "pack_format": 14
+ }
+} \ No newline at end of file