From a694321b8952a64d43134961d58fb60e1adc0cf5 Mon Sep 17 00:00:00 2001 From: isXander Date: Thu, 7 Dec 2023 18:34:17 +0000 Subject: 1.20.4 + Migrate from Forge platform to NeoForge platform --- build.gradle.kts | 7 +- common/build.gradle.kts | 4 +- fabric/build.gradle.kts | 4 +- forge/.gitignore | 42 ----- forge/build.gradle.kts | 197 --------------------- forge/gradle.properties | 1 - .../yacl3/platform/forge/YACLForgeEntrypoint.java | 11 -- .../yacl3/platform/forge/YACLPlatformImpl.java | 24 --- forge/src/main/resources/META-INF/mods.toml | 28 --- forge/src/main/resources/pack.mcmeta | 6 - gradle.properties | 2 +- gradle/libs.versions.toml | 17 +- neoforge/.gitignore | 42 +++++ neoforge/build.gradle.kts | 188 ++++++++++++++++++++ neoforge/gradle.properties | 1 + .../platform/neoforge/YACLForgeEntrypoint.java | 11 ++ .../yacl3/platform/neoforge/YACLPlatformImpl.java | 24 +++ neoforge/src/main/resources/META-INF/mods.toml | 31 ++++ neoforge/src/main/resources/pack.mcmeta | 6 + settings.gradle.kts | 8 +- test-common/build.gradle.kts | 4 +- test-fabric/build.gradle.kts | 4 +- test-forge/.gitignore | 42 ----- test-forge/build.gradle.kts | 74 -------- test-forge/gradle.properties | 1 - .../dev/isxander/yacl3/test/forge/ForgeTest.java | 10 -- test-forge/src/main/resources/META-INF/mods.toml | 28 --- test-forge/src/main/resources/pack.mcmeta | 6 - test-neoforge/.gitignore | 42 +++++ test-neoforge/build.gradle.kts | 77 ++++++++ test-neoforge/gradle.properties | 1 + .../dev/isxander/yacl3/test/forge/ForgeTest.java | 10 ++ .../src/main/resources/META-INF/mods.toml | 31 ++++ test-neoforge/src/main/resources/pack.mcmeta | 6 + 34 files changed, 489 insertions(+), 501 deletions(-) delete mode 100644 forge/.gitignore delete mode 100644 forge/build.gradle.kts delete mode 100644 forge/gradle.properties delete mode 100644 forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLForgeEntrypoint.java delete mode 100644 forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLPlatformImpl.java delete mode 100644 forge/src/main/resources/META-INF/mods.toml delete mode 100644 forge/src/main/resources/pack.mcmeta create mode 100644 neoforge/.gitignore create mode 100644 neoforge/build.gradle.kts create mode 100644 neoforge/gradle.properties create mode 100644 neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java create mode 100644 neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLPlatformImpl.java create mode 100644 neoforge/src/main/resources/META-INF/mods.toml create mode 100644 neoforge/src/main/resources/pack.mcmeta delete mode 100644 test-forge/.gitignore delete mode 100644 test-forge/build.gradle.kts delete mode 100644 test-forge/gradle.properties delete mode 100644 test-forge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java delete mode 100644 test-forge/src/main/resources/META-INF/mods.toml delete mode 100644 test-forge/src/main/resources/pack.mcmeta create mode 100644 test-neoforge/.gitignore create mode 100644 test-neoforge/build.gradle.kts create mode 100644 test-neoforge/gradle.properties create mode 100644 test-neoforge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java create mode 100644 test-neoforge/src/main/resources/META-INF/mods.toml create mode 100644 test-neoforge/src/main/resources/pack.mcmeta diff --git a/build.gradle.kts b/build.gradle.kts index a614627..ba6553a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,6 @@ plugins { alias(libs.plugins.architectury.plugin) alias(libs.plugins.architectury.loom) apply false - alias(libs.plugins.loom.vineflower) apply false alias(libs.plugins.minotaur) apply false alias(libs.plugins.cursegradle) apply false @@ -45,6 +44,8 @@ allprojects { maven("https://maven.isxander.dev/releases") maven("https://maven.isxander.dev/snapshots") maven("https://maven.quiltmc.org/repository/release") + maven("https://maven.neoforged.net/releases") + maven("https://maven.parchmentmc.org") maven("https://api.modrinth.com/maven") { name = "Modrinth" content { @@ -81,10 +82,6 @@ allprojects { } } -subprojects { - apply(plugin = rootProject.libs.plugins.loom.vineflower.get().pluginId) -} - githubRelease { token(findProperty("GITHUB_TOKEN")?.toString()) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index ba6dd04..c56f517 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -20,10 +20,8 @@ loom { dependencies { minecraft(libs.minecraft) mappings(loom.layered { - val qm = libs.versions.quilt.mappings.get() - if (qm != "0") - mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") officialMojangMappings() + parchment(libs.parchment) }) modImplementation(libs.fabric.loader) diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 36c6976..914e3ae 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -28,10 +28,8 @@ val minecraftVersion = libs.versions.minecraft.get() dependencies { minecraft(libs.minecraft) mappings(loom.layered { - val qm = libs.versions.quilt.mappings.get() - if (qm != "0") - mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") officialMojangMappings() + parchment(libs.parchment) }) modImplementation(libs.fabric.loader) diff --git a/forge/.gitignore b/forge/.gitignore deleted file mode 100644 index b63da45..0000000 --- a/forge/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -.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 deleted file mode 100644 index d4f4c0e..0000000 --- a/forge/build.gradle.kts +++ /dev/null @@ -1,197 +0,0 @@ -import org.gradle.api.component.AdhocComponentWithVariants -import org.gradle.jvm.tasks.Jar -import org.gradle.kotlin.dsl.get -import org.gradle.kotlin.dsl.libs - -plugins { - alias(libs.plugins.architectury.loom) - alias(libs.plugins.shadow) - alias(libs.plugins.minotaur) - alias(libs.plugins.cursegradle) -} - -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 { - val qm = libs.versions.quilt.mappings.get() - if (qm != "0") - mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") - officialMojangMappings() - }) - forge(libs.forge) - - libs.bundles.twelvemonkeys.imageio.let { - implementation(it) - include(it) - forgeRuntimeLibrary(it) - } - libs.bundles.quilt.parsers.let { - implementation(it) - include(it) - forgeRuntimeLibrary(it) - } - - "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("sourcesJar") { - archiveClassifier.set("dev-sources") - val commonSources = project(":common").tasks.named("sourcesJar") - dependsOn(commonSources) - from(commonSources.get().archiveFile.map { zipTree(it) }) - } - - remapSourcesJar { - archiveClassifier.set("sources") - } - - jar { - archiveClassifier.set("dev") - } -} - -components["java"].run { - if (this is AdhocComponentWithVariants) { - withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { - skip() - } - } -} - -val changelogText: String by ext -val isBeta: Boolean by ext - -val modrinthId: String by project -if (modrinthId.isNotEmpty()) { - modrinth { - token.set(findProperty("modrinth.token")?.toString()) - projectId.set(modrinthId) - versionName.set("${project.version} (Forge)") - versionNumber.set("${project.version}-forge") - versionType.set(if (isBeta) "beta" else "release") - uploadFile.set(tasks["remapJar"]) - gameVersions.set(listOf("1.20.2")) - loaders.set(listOf("forge", "neoforge")) - changelog.set(changelogText) - syncBodyFrom.set(rootProject.file("README.md").readText()) - } -} -rootProject.tasks["releaseMod"].dependsOn(tasks["modrinth"]) - -val curseforgeId: String by project -if (hasProperty("curseforge.token") && curseforgeId.isNotEmpty()) { - curseforge { - apiKey = findProperty("curseforge.token") - project(closureOf { - mainArtifact(tasks["remapJar"], closureOf { - displayName = "[Forge] ${project.version}" - }) - - id = curseforgeId - releaseType = if (isBeta) "beta" else "release" - addGameVersion("1.20.2") - addGameVersion("Forge") - addGameVersion("NeoForge") - addGameVersion("Java 17") - - changelog = changelogText - changelogType = "markdown" - }) - - options(closureOf { - forgeGradleIntegration = false - fabricIntegration = false - }) - } -} -rootProject.tasks["releaseMod"].dependsOn(tasks["curseforge"]) - -publishing { - publications { - create("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 deleted file mode 100644 index 32f842a..0000000 --- a/forge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform=forge \ No newline at end of file diff --git a/forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLForgeEntrypoint.java b/forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLForgeEntrypoint.java deleted file mode 100644 index 0301add..0000000 --- a/forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLForgeEntrypoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.isxander.yacl3.platform.forge; - -import net.minecraftforge.fml.common.Mod; - -@Mod("yet_another_config_lib_v3") -public class YACLForgeEntrypoint { - public YACLForgeEntrypoint() { - - } - -} diff --git a/forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLPlatformImpl.java b/forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLPlatformImpl.java deleted file mode 100644 index 6b10cb6..0000000 --- a/forge/src/main/java/dev/isxander/yacl3/platform/forge/YACLPlatformImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.isxander.yacl3.platform.forge; - -import dev.isxander.yacl3.platform.Env; -import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.fml.loading.FMLPaths; - -import java.nio.file.Path; - -public class YACLPlatformImpl { - public static Env getEnvironment() { - return switch (FMLEnvironment.dist) { - case CLIENT -> Env.CLIENT; - case DEDICATED_SERVER -> Env.SERVER; - }; - } - - public static boolean isDevelopmentEnv() { - return !FMLEnvironment.production; - } - - public static Path getConfigDir() { - return FMLPaths.CONFIGDIR.get(); - } -} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index dbd8461..0000000 --- a/forge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,28 +0,0 @@ -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.20.2,)" -ordering = "NONE" -side = "BOTH" diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta deleted file mode 100644 index a9c6340..0000000 --- a/forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "${name}", - "pack_format": 14 - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 30a4ee4..f2a36fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,4 +8,4 @@ modrinthId=yacl curseforgeId=667299 githubProject=isXander/YetAnotherConfigLib -loaders=fabric +loaders=fabric,neoforge diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 917f871..eaf7d03 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,18 +1,17 @@ [versions] # Plugins -architectury_loom = "1.3.+" +architectury_loom = "1.4.+" architectury_plugin = "3.4.+" shadow = "7.1.+" -loom_vineflower = "1.11.+" minotaur = "2.7.+" cursegradle = "2.+" github_release = "2.4.+" machete = "2.+" grgit = "5.0.+" -minecraft = "1.20.3" -quilt_mappings = "0" -fabric_loader = "0.14.23" +minecraft = "1.20.4" +parchment = "2023.10.22" +fabric_loader = "0.14.25" # Common Dependencies mixin_extras = "0.2.0" @@ -20,14 +19,15 @@ twelvemonkeys_imageio = "3.10.0" quilt_parsers = "0.2.1" # Fabric-like Dependencies -fabric_api = "0.90.11+1.20.3" +fabric_api = "0.91.1+1.20.3" # Forge Dependencies -forge = "1.20.2-48.0.33" +neoforge = "20.4.0-beta" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } +parchment = { module = "org.parchmentmc.data:parchment-1.20.2", version.ref = "parchment" } # Common Dependencies mixin_extras_common = { module = "com.github.llamalad7.mixinextras:mixinextras-common", version.ref = "mixin_extras" } @@ -44,7 +44,7 @@ quilt_parsers_gson = { module = "org.quiltmc.parsers:gson", version.ref = "quilt fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } # Forge Dependencies -forge = { module = "net.minecraftforge:forge", version.ref = "forge" } +neoforge = { module = "net.neoforged:neoforge", version.ref = "neoforge" } [bundles] twelvemonkeys_imageio = [ @@ -63,7 +63,6 @@ quilt_parsers = [ [plugins] architectury_loom = { id = "dev.architectury.loom", version.ref = "architectury_loom" } architectury_plugin = { id = "architectury-plugin", version.ref = "architectury_plugin" } -loom_vineflower = { id = "io.github.juuxel.loom-vineflower", version.ref = "loom_vineflower" } shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" } diff --git a/neoforge/.gitignore b/neoforge/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/neoforge/.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/neoforge/build.gradle.kts b/neoforge/build.gradle.kts new file mode 100644 index 0000000..7b09032 --- /dev/null +++ b/neoforge/build.gradle.kts @@ -0,0 +1,188 @@ +import org.gradle.api.component.AdhocComponentWithVariants +import org.gradle.jvm.tasks.Jar +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.libs + +plugins { + alias(libs.plugins.architectury.loom) + alias(libs.plugins.shadow) + alias(libs.plugins.minotaur) + alias(libs.plugins.cursegradle) +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) + + neoForge { + + } +} + +val common by configurations.registering +val shadowCommon by configurations.registering +configurations.compileClasspath.get().extendsFrom(common.get()) +configurations["developmentNeoForge"].extendsFrom(common.get()) + +val minecraftVersion: String = libs.versions.minecraft.get() + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + officialMojangMappings() + parchment(libs.parchment) + }) + neoForge(libs.neoforge) + + libs.bundles.twelvemonkeys.imageio.let { + implementation(it) + include(it) + forgeRuntimeLibrary(it) + } + libs.bundles.quilt.parsers.let { + implementation(it) + include(it) + forgeRuntimeLibrary(it) + } + + "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 + + 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) + + 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, + ) + } + } + + 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("sourcesJar") { + archiveClassifier.set("dev-sources") + val commonSources = project(":common").tasks.named("sourcesJar") + dependsOn(commonSources) + from(commonSources.get().archiveFile.map { zipTree(it) }) + } + + remapSourcesJar { + archiveClassifier.set("sources") + } + + jar { + archiveClassifier.set("dev") + } +} + +components["java"].run { + if (this is AdhocComponentWithVariants) { + withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { + skip() + } + } +} + +val changelogText: String by ext +val isBeta: Boolean by ext + +val modrinthId: String by project +if (modrinthId.isNotEmpty()) { + modrinth { + token.set(findProperty("modrinth.token")?.toString()) + projectId.set(modrinthId) + versionName.set("${project.version} (Forge)") + versionNumber.set("${project.version}-neoforge") + versionType.set(if (isBeta) "beta" else "release") + uploadFile.set(tasks["remapJar"]) + gameVersions.set(listOf("1.20.4")) + loaders.set(listOf("neoforge")) + changelog.set(changelogText) + syncBodyFrom.set(rootProject.file("README.md").readText()) + } +} +rootProject.tasks["releaseMod"].dependsOn(tasks["modrinth"]) + +val curseforgeId: String by project +if (hasProperty("curseforge.token") && curseforgeId.isNotEmpty()) { + curseforge { + apiKey = findProperty("curseforge.token") + project(closureOf { + mainArtifact(tasks["remapJar"], closureOf { + displayName = "[Forge] ${project.version}" + }) + + id = curseforgeId + releaseType = if (isBeta) "beta" else "release" + addGameVersion("1.20.4") + addGameVersion("NeoForge") + addGameVersion("Java 17") + + changelog = changelogText + changelogType = "markdown" + }) + + options(closureOf { + forgeGradleIntegration = false + fabricIntegration = false + }) + } +} +rootProject.tasks["releaseMod"].dependsOn(tasks["curseforge"]) + +publishing { + publications { + create("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/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/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java b/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java new file mode 100644 index 0000000..343635e --- /dev/null +++ b/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLForgeEntrypoint.java @@ -0,0 +1,11 @@ +package dev.isxander.yacl3.platform.neoforge; + +import net.neoforged.fml.common.Mod; + +@Mod("yet_another_config_lib_v3") +public class YACLForgeEntrypoint { + public YACLForgeEntrypoint() { + + } + +} diff --git a/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLPlatformImpl.java b/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLPlatformImpl.java new file mode 100644 index 0000000..42a51d6 --- /dev/null +++ b/neoforge/src/main/java/dev/isxander/yacl3/platform/neoforge/YACLPlatformImpl.java @@ -0,0 +1,24 @@ +package dev.isxander.yacl3.platform.neoforge; + +import dev.isxander.yacl3.platform.Env; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.fml.loading.FMLPaths; + +import java.nio.file.Path; + +public class YACLPlatformImpl { + public static Env getEnvironment() { + return switch (FMLEnvironment.dist) { + case CLIENT -> Env.CLIENT; + case DEDICATED_SERVER -> Env.SERVER; + }; + } + + public static boolean isDevelopmentEnv() { + return !FMLEnvironment.production; + } + + public static Path getConfigDir() { + return FMLPaths.CONFIGDIR.get(); + } +} 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..4a68c54 --- /dev/null +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,31 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +#issueTrackerURL = "" +license = "LGPL-3.0-or-later" + +[[mods]] +modId = "${id}" +version = "${version}" +displayName = "${name}" +authors = "isXander" +description = ''' +${description} +''' +logoFile = "yacl-128x.png" + +[[mixins]] +config = "yacl.mixins.json" + +[["dependencies.${id}"]] +modId = "neoforge" +mandatory = true +versionRange = "[1,)" +ordering = "NONE" +side = "BOTH" + +[["dependencies.${id}"]] +modId = "minecraft" +mandatory = true +versionRange = "[1.20.2,)" +ordering = "NONE" +side = "BOTH" diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..a9c6340 --- /dev/null +++ b/neoforge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "${name}", + "pack_format": 14 + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index bdda698..ed41045 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,7 +4,7 @@ pluginManagement { gradlePluginPortal() maven("https://maven.fabricmc.net") maven("https://maven.architectury.dev/") - maven("https://maven.minecraftforge.net/") + maven("https://maven.neoforged.net/releases") maven("https://maven.quiltmc.org/repository/release") } } @@ -27,7 +27,7 @@ if ("fabric" in enabledLoaders) { include("test-fabric") } -if ("forge" in enabledLoaders) { - include("forge") - include("test-forge") +if ("neoforge" in enabledLoaders) { + include("neoforge") + include("test-neoforge") } diff --git a/test-common/build.gradle.kts b/test-common/build.gradle.kts index 6bdfb0a..bd95f1e 100644 --- a/test-common/build.gradle.kts +++ b/test-common/build.gradle.kts @@ -16,10 +16,8 @@ loom { dependencies { minecraft(libs.minecraft) mappings(loom.layered { - val qm = libs.versions.quilt.mappings.get() - if (qm != "0") - mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") officialMojangMappings() + parchment(libs.parchment) }) modImplementation(libs.fabric.loader) diff --git a/test-fabric/build.gradle.kts b/test-fabric/build.gradle.kts index f2145d9..17658cd 100644 --- a/test-fabric/build.gradle.kts +++ b/test-fabric/build.gradle.kts @@ -24,10 +24,8 @@ val minecraftVersion = libs.versions.minecraft.get() dependencies { minecraft(libs.minecraft) mappings(loom.layered { - val qm = libs.versions.quilt.mappings.get() - if (qm != "0") - mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") officialMojangMappings() + parchment(libs.parchment) }) modImplementation(libs.fabric.loader) diff --git a/test-forge/.gitignore b/test-forge/.gitignore deleted file mode 100644 index b63da45..0000000 --- a/test-forge/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -.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/test-forge/build.gradle.kts b/test-forge/build.gradle.kts deleted file mode 100644 index 30a02e9..0000000 --- a/test-forge/build.gradle.kts +++ /dev/null @@ -1,74 +0,0 @@ -import org.gradle.kotlin.dsl.libs - -plugins { - alias(libs.plugins.architectury.loom) - alias(libs.plugins.shadow) -} - -architectury { - platformSetupLoomIde() - forge() -} - -loom { - silentMojangMappingsLicense() - - accessWidenerPath.set(project(":common").loom.accessWidenerPath) - - forge { - 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 { - val qm = libs.versions.quilt.mappings.get() - if (qm != "0") - mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quilt.mappings.get()}:intermediary-v2") - officialMojangMappings() - }) - forge(libs.forge) - - implementation(libs.twelvemonkeys.imageio.core) - forgeRuntimeLibrary(libs.twelvemonkeys.imageio.core) - implementation(libs.twelvemonkeys.imageio.webp) - forgeRuntimeLibrary(libs.twelvemonkeys.imageio.webp) - implementation(libs.bundles.quilt.parsers) - forgeRuntimeLibrary(libs.bundles.quilt.parsers) - - "common"(project(path = ":test-common", configuration = "namedElements")) { isTransitive = false } - "common"(project(path = ":forge", configuration = "namedElements")) { isTransitive = false } - - "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false } -} - -tasks { - 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("forge-$minecraftVersion") - } - - jar { - archiveClassifier.set("dev") - } -} diff --git a/test-forge/gradle.properties b/test-forge/gradle.properties deleted file mode 100644 index 32f842a..0000000 --- a/test-forge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform=forge \ No newline at end of file diff --git a/test-forge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java b/test-forge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java deleted file mode 100644 index f9a95b6..0000000 --- a/test-forge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java +++ /dev/null @@ -1,10 +0,0 @@ -package dev.isxander.yacl3.test.forge; - -import net.minecraftforge.fml.common.Mod; - -@Mod("yacl_test") -public class ForgeTest { - public ForgeTest() { - - } -} diff --git a/test-forge/src/main/resources/META-INF/mods.toml b/test-forge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index cbccdaf..0000000 --- a/test-forge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,28 +0,0 @@ -modLoader = "javafml" -loaderVersion = "[48,)" -#issueTrackerURL = "" -license = "LGPL-3.0-or-later" - -[[mods]] -modId = "yacl_test" -version = "1" -displayName = "YACL Test" -authors = "isXander" -description = ''' -Test mod for YACL -''' -#logoFile = "" - -[[dependencies.yacl_test]] -modId = "forge" -mandatory = true -versionRange = "[48,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.yacl_test]] -modId = "minecraft" -mandatory = true -versionRange = "[1.20.2,)" -ordering = "NONE" -side = "BOTH" diff --git a/test-forge/src/main/resources/pack.mcmeta b/test-forge/src/main/resources/pack.mcmeta deleted file mode 100644 index 8fbe236..0000000 --- a/test-forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "Test YACL", - "pack_format": 14 - } -} diff --git a/test-neoforge/.gitignore b/test-neoforge/.gitignore new file mode 100644 index 0000000..b63da45 --- /dev/null +++ b/test-neoforge/.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/test-neoforge/build.gradle.kts b/test-neoforge/build.gradle.kts new file mode 100644 index 0000000..32622d9 --- /dev/null +++ b/test-neoforge/build.gradle.kts @@ -0,0 +1,77 @@ +import org.gradle.kotlin.dsl.libs + +plugins { + alias(libs.plugins.architectury.loom) + alias(libs.plugins.shadow) +} + +architectury { + platformSetupLoomIde() + neoForge() +} + +loom { + silentMojangMappingsLicense() + + accessWidenerPath.set(project(":common").loom.accessWidenerPath) + + neoForge { + + } + + mods { + maybeCreate("forge").apply { + sourceSet(project(":neoforge").sourceSets.main.get()) + } + } +} + +val common by configurations.registering +val shadowCommon by configurations.registering +configurations.compileClasspath.get().extendsFrom(common.get()) +configurations["developmentNeoForge"].extendsFrom(common.get()) + +val minecraftVersion: String = libs.versions.minecraft.get() + +dependencies { + minecraft(libs.minecraft) + mappings(loom.layered { + officialMojangMappings() + parchment(libs.parchment) + }) + neoForge(libs.neoforge) + + implementation(libs.twelvemonkeys.imageio.core) + forgeRuntimeLibrary(libs.twelvemonkeys.imageio.core) + implementation(libs.twelvemonkeys.imageio.webp) + forgeRuntimeLibrary(libs.twelvemonkeys.imageio.webp) + implementation(libs.bundles.quilt.parsers) + forgeRuntimeLibrary(libs.bundles.quilt.parsers) + + "common"(project(path = ":test-common", configuration = "namedElements")) { isTransitive = false } + implementation(project(path = ":neoforge", configuration = "namedElements")) { isTransitive = false } + + "common"(project(path = ":common", configuration = "namedElements")) { isTransitive = false } +} + +tasks { + 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("neoforge-$minecraftVersion") + } + + jar { + archiveClassifier.set("dev") + } +} diff --git a/test-neoforge/gradle.properties b/test-neoforge/gradle.properties new file mode 100644 index 0000000..7da18ea --- /dev/null +++ b/test-neoforge/gradle.properties @@ -0,0 +1 @@ +loom.platform=neoforge diff --git a/test-neoforge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java b/test-neoforge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java new file mode 100644 index 0000000..c27cdd8 --- /dev/null +++ b/test-neoforge/src/main/java/dev/isxander/yacl3/test/forge/ForgeTest.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl3.test.forge; + +import net.neoforged.fml.common.Mod; + +@Mod("yacl_test") +public class ForgeTest { + public ForgeTest() { + + } +} diff --git a/test-neoforge/src/main/resources/META-INF/mods.toml b/test-neoforge/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..6cb1824 --- /dev/null +++ b/test-neoforge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,31 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +#issueTrackerURL = "" +license = "LGPL-3.0-or-later" + +[[mods]] +modId = "yacl_test" +version = "1" +displayName = "YACL Test" +authors = "isXander" +description = ''' +Test mod for YACL +''' +#logoFile = "" + +[[mixins]] +config = "yacl-test.mixins.json" + +[[dependencies.yacl_test]] +modId = "neoforge" +mandatory = true +versionRange = "[20,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.yacl_test]] +modId = "minecraft" +mandatory = true +versionRange = "1.20.4" +ordering = "NONE" +side = "BOTH" diff --git a/test-neoforge/src/main/resources/pack.mcmeta b/test-neoforge/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..8fbe236 --- /dev/null +++ b/test-neoforge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "Test YACL", + "pack_format": 14 + } +} -- cgit