Skip to content

Commit 8f5e2a8

Browse files
committed
Properly set up mod loader stuff
1 parent 3e17d54 commit 8f5e2a8

File tree

13 files changed

+461
-28
lines changed

13 files changed

+461
-28
lines changed

build.gradle.kts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ stonecutter {
3232
/*
3333
version = "${project.property("mod.version")}+mc${mcData.version}-${mcData.loader.friendlyString}"
3434
35-
val leastCommonMcVersion = when (mcData.version) {
36-
MinecraftVersions.VERSION_1_21_10 -> "1.21.9"
37-
MinecraftVersions.VERSION_1_21_8 -> "1.21.6"
38-
MinecraftVersions.VERSION_1_21_4 -> "1.21.3"
39-
MinecraftVersions.VERSION_1_21_1 -> "1.21"
40-
else -> mcData.version.toString()
41-
}
42-
4335
val architecturyVersion = when (mcData.version) {
4436
MinecraftVersions.VERSION_1_20_1 -> "9.2.14"
4537
MinecraftVersions.VERSION_1_20_4 -> "11.1.17"

fabric/build.gradle.kts

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
@file:Suppress("UnstableApiUsage")
2+
3+
4+
plugins {
5+
id("dev.architectury.loom")
6+
id("architectury-plugin")
7+
id("com.gradleup.shadow")
8+
}
9+
10+
val loader = prop("loom.platform")!!
11+
val minecraftVersion: String = stonecutter.current.version
12+
val common: Project = requireNotNull(stonecutter.node.sibling("")?.project) {
13+
"No common project for $project"
14+
}
15+
16+
architectury {
17+
platformSetupLoomIde()
18+
fabric()
19+
}
20+
21+
val commonBundle: Configuration by configurations.creating {
22+
isCanBeConsumed = false
23+
isCanBeResolved = true
24+
}
25+
26+
val shadowBundle: Configuration by configurations.creating {
27+
isCanBeConsumed = false
28+
isCanBeResolved = true
29+
}
30+
31+
configurations {
32+
compileClasspath.get().extendsFrom(commonBundle)
33+
runtimeClasspath.get().extendsFrom(commonBundle)
34+
get("developmentFabric").extendsFrom(commonBundle)
35+
}
36+
37+
repositories {
38+
maven("https://maven.terraformersmc.com")
39+
maven("https://maven.nucleoid.xyz/") // Not sure why but we need this
40+
}
41+
42+
dependencies {
43+
modImplementation("net.fabricmc:fabric-loader:${common.mod.dep("fabric_loader")}")
44+
modImplementation("net.fabricmc.fabric-api:fabric-api:${common.mod.dep("fabric_api")}")
45+
modImplementation("net.fabricmc:fabric-language-kotlin:${common.mod.dep("fabric_kotlin")}")
46+
47+
modImplementation("com.terraformersmc:modmenu:${common.mod.dep("modmenu")}")
48+
49+
modImplementation("maven.modrinth:talk-balloons:${common.mod.dep("talk_balloons")}+${common.mod.dep("talk_balloons_mc")}-fabric")
50+
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${common.mod.dep("cloth_config")}")
51+
52+
commonBundle(project(common.path, "namedElements")) { isTransitive = false }
53+
shadowBundle(project(common.path, "transformProductionFabric")) { isTransitive = false }
54+
55+
modImplementation("xyz.bluspring.modernnetworking:modernnetworking-fabric:${common.mod.dep("modernnetworking")}+${common.mod.dep("modernnetworking_mc")}")!!
56+
modImplementation("net.fabricmc:fabric-language-kotlin:${common.mod.dep("fabric_kotlin")}")
57+
}
58+
59+
tasks.shadowJar {
60+
configurations = listOf(shadowBundle)
61+
archiveClassifier = "dev-shadow"
62+
}
63+
64+
tasks.jar {
65+
archiveClassifier = "dev"
66+
}
67+
68+
tasks.processResources {
69+
properties(listOf("fabric.mod.json"),
70+
"mod_id" to mod.id,
71+
"mod_name" to mod.name,
72+
"mod_version" to mod.version,
73+
"mod_description" to mod.prop("description"),
74+
"mod_authors" to mod.prop("authors"),
75+
"minecraft_version_range" to common.mod.prop("mc_dep_fabric"),
76+
"fabric_loader_version" to common.mod.dep("fabric_loader"),
77+
"cloth_config_version" to common.mod.dep("cloth_config"),
78+
"modernnetworking_version" to common.mod.dep("modernnetworking")
79+
)
80+
}
81+
82+
tasks.build {
83+
group = "versioned"
84+
description = "Must run through 'chiseledBuild'"
85+
}
86+
87+
tasks.register<Copy>("buildAndCollect") {
88+
group = "versioned"
89+
description = "Must run through 'chiseledBuild'"
90+
from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile)
91+
into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader"))
92+
dependsOn("build")
93+
}

forge/build.gradle.kts

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
plugins {
2+
id("dev.architectury.loom")
3+
id("architectury-plugin")
4+
id("com.gradleup.shadow")
5+
}
6+
7+
val loader = prop("loom.platform")!!
8+
val minecraftVersion = stonecutter.current.version
9+
10+
val common: Project = requireNotNull(stonecutter.node.sibling("")?.project) {
11+
"No common project for $project"
12+
}
13+
14+
architectury {
15+
platformSetupLoomIde()
16+
forge()
17+
}
18+
19+
val commonBundle: Configuration by configurations.creating {
20+
isCanBeConsumed = false
21+
isCanBeResolved = true
22+
}
23+
24+
val shadowBundle: Configuration by configurations.creating {
25+
isCanBeConsumed = false
26+
isCanBeResolved = true
27+
}
28+
29+
configurations {
30+
compileClasspath.get().extendsFrom(commonBundle)
31+
runtimeClasspath.get().extendsFrom(commonBundle)
32+
get("developmentForge").extendsFrom(commonBundle)
33+
}
34+
35+
repositories {
36+
maven("https://maven.minecraftforge.net/")
37+
}
38+
39+
dependencies {
40+
"forge"("net.minecraftforge:forge:$minecraftVersion-${common.mod.dep("forge")}")
41+
42+
modImplementation("maven.modrinth:talk-balloons:${common.mod.dep("talk_balloons")}+${common.mod.dep("talk_balloons_mc")}-forge")
43+
modImplementation("me.shedaniel.cloth:cloth-config-forge:${common.mod.dep("cloth_config")}")
44+
45+
commonBundle(project(common.path, "namedElements")) { isTransitive = false }
46+
shadowBundle(project(common.path, "transformProductionForge")) { isTransitive = false }
47+
48+
modImplementation("dev.nyon:KotlinLangForge:${common.mod.dep("kotlinlangforge")}-${common.mod.dep("kotlinlangforge_loader")}+forge")
49+
modImplementation("xyz.bluspring.modernnetworking:modernnetworking-forge:${common.mod.dep("modernnetworking")}+${common.mod.dep("modernnetworking_mc")}")!!
50+
}
51+
52+
loom {
53+
runConfigs.all {
54+
isIdeConfigGenerated = true
55+
runDir = "../../../run"
56+
vmArgs("-Dmixin.debug.export=true", "-XX:+AllowEnhancedClassRedefinition")
57+
}
58+
}
59+
60+
tasks.shadowJar {
61+
configurations = listOf(shadowBundle)
62+
archiveClassifier = "dev-shadow"
63+
exclude("fabric.mod.json", "architectury.common.json")
64+
}
65+
66+
tasks.processResources {
67+
properties(listOf("META-INF/neoforge.mods.toml", "META-INF/mods.toml"),
68+
"mod_id" to mod.id,
69+
"mod_name" to mod.name,
70+
"mod_version" to mod.version,
71+
"mod_description" to mod.prop("description"),
72+
"mod_authors" to mod.prop("authors"),
73+
"minecraft_version_range" to common.mod.prop("mc_dep_forgelike"),
74+
"neoforge_version" to common.mod.dep("neoforge"),
75+
"cloth_config_version" to common.mod.dep("cloth_config"),
76+
"modernnetworking_version" to common.mod.dep("modernnetworking"),
77+
"kotlinlangforge_loader" to common.mod.dep("kotlinlangforge_loader"),
78+
"kotlinlangforge_version" to common.mod.dep("kotlinlangforge")
79+
)
80+
}
81+
82+
tasks.build {
83+
group = "versioned"
84+
description = "Must run through 'chiseledBuild'"
85+
}
86+
87+
tasks.register<Copy>("buildAndCollect") {
88+
group = "versioned"
89+
description = "Must run through 'chiseledBuild'"
90+
from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile)
91+
into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader"))
92+
dependsOn("build")
93+
}

gradle.properties

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,75 @@ mod.version = 0.2.0-beta
1515
mod.group = xyz.bluspring
1616
mod.name = UnityTranslate
1717
mod.id = unitytranslate
18+
mod.description = A mod designed for free live translation, inspired by the QSMP. Mainly created for the Unity Multiplayer server, and for public release towards the multilingual Minecraft community.
1819

1920
# Dependencies
2021

2122
### Common
23+
mod.supported_versions = [VERSIONED]
24+
25+
# https://parchmentmc.org/docs/getting-started
26+
deps.parchment_version = [VERSIONED]
27+
deps.parchment_snapshot = [VERSIONED]
28+
2229
# https://maven.maxhenkel.de/#/releases/de/maxhenkel/voicechat/voicechat-api
23-
voicechat_api_version=2.6.0
30+
deps.voicechat_api = 2.6.0
2431
# https://github.com/plasmoapp/plasmo-voice/releases
25-
plasmo_api_version=2.1.6
32+
deps.plasmo_api = 2.1.6
2633

2734
# https://modrinth.com/mod/simple-voice-chat/versions?g=1.20.1
28-
voicechat_version=2.6.6
35+
deps.voicechat = 2.6.6
2936

3037
# https://modrinth.com/plugin/plasmo-voice/versions?g=1.20.1
31-
plasmo_version=2.1.6
38+
deps.plasmo = 2.1.6
3239

33-
kotlin_version=2.2.21
34-
kotlin_coroutines_version=1.10.2
35-
kotlin_serialization_version=1.9.0
40+
deps.kotlin = 2.2.21
3641

3742
# https://central.sonatype.com/artifact/com.squareup.okhttp3/okhttp/4.12.0/versions
38-
okhttp_version=5.3.1
43+
deps.okhttp = 5.3.1
3944

4045
# http://mvn.devos.one/#/snapshots/xyz/bluspring/unitytranslate/UnityTranslateLib
41-
unitytranslatelib_version = 0.4.2
46+
deps.unitytranslatelib = 0.4.2
4247

4348
# https://central.sonatype.com/artifact/com.github.jnr/jnr-ffi?smo=true
44-
jnr_version = 2.2.17
49+
deps.jnr = 2.2.17
50+
51+
# https://modrinth.com/mod/talk-balloons
52+
deps.talk_balloons = 1.4.0
53+
54+
# https://modrinth.com/mod/modernnetworking
55+
deps.modernnetworking = 1.2.2
56+
deps.modernnetworking_mc = [VERSIONED]
57+
58+
# https://modrinth.com/mod/cloth-config
59+
deps.cloth_config = [VERSIONED]
60+
61+
### Fabric
62+
mod.mc_dep_fabric = [VERSIONED]
63+
64+
deps.fabric_loader = 0.17.3
65+
66+
# https://modrinth.com/mod/fabric-api
67+
deps.fabric_api = [VERSIONED]
68+
69+
# https://modrinth.com/mod/fabric-language-kotlin
70+
deps.fabric_kotlin = 1.13.7+kotlin.2.2.21
71+
72+
# https://modrinth.com/mod/modmenu
73+
deps.modmenu = [VERSIONED]
74+
75+
76+
### Forge / NeoForge
77+
78+
mod.mc_dep_forgelike = [VERSIONED]
4579

4680
# https://modrinth.com/mod/kotlin-lang-forge
47-
kotlinlangforge_version = 2.10.6
81+
deps.kotlinlangforge = 2.10.6-k2.2.21
82+
deps.kotlinlangforge_loader = [VERSIONED]
4883

49-
# https://modrinth.com/mod/talk-balloons
50-
talk_balloons_version = 1.3.1
84+
85+
### Forge
86+
deps.forge = [VERSIONED]
87+
88+
### NeoForge
89+
deps.neoforge = [VERSIONED]

neoforge/build.gradle.kts

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
plugins {
2+
id("dev.architectury.loom")
3+
id("architectury-plugin")
4+
id("com.gradleup.shadow")
5+
}
6+
7+
val loader = prop("loom.platform")!!
8+
val minecraftVersion = stonecutter.current.version
9+
10+
val common: Project = requireNotNull(stonecutter.node.sibling("")?.project) {
11+
"No common project for $project"
12+
}
13+
14+
architectury {
15+
platformSetupLoomIde()
16+
neoForge()
17+
}
18+
19+
val commonBundle: Configuration by configurations.creating {
20+
isCanBeConsumed = false
21+
isCanBeResolved = true
22+
}
23+
24+
val shadowBundle: Configuration by configurations.creating {
25+
isCanBeConsumed = false
26+
isCanBeResolved = true
27+
}
28+
29+
configurations {
30+
compileClasspath.get().extendsFrom(commonBundle)
31+
runtimeClasspath.get().extendsFrom(commonBundle)
32+
get("developmentNeoForge").extendsFrom(commonBundle)
33+
}
34+
35+
repositories {
36+
maven("https://maven.neoforged.net/releases/")
37+
}
38+
39+
dependencies {
40+
"neoForge"("net.neoforged:neoforge:${common.mod.dep("neoforge")}")
41+
42+
modImplementation("maven.modrinth:talk-balloons:${common.mod.dep("talk_balloons")}+${common.mod.dep("talk_balloons_mc")}-neoforge")
43+
modImplementation("me.shedaniel.cloth:cloth-config-neoforge:${common.mod.dep("cloth_config")}")
44+
45+
commonBundle(project(common.path, "namedElements")) { isTransitive = false }
46+
shadowBundle(project(common.path, "transformProductionNeoForge")) { isTransitive = false }
47+
48+
modImplementation("dev.nyon:KotlinLangForge:${common.mod.dep("kotlinlangforge")}-${common.mod.dep("kotlinlangforge_loader")}+neoforge")
49+
modImplementation("xyz.bluspring.modernnetworking:modernnetworking-neoforge:${common.mod.dep("modernnetworking")}+${common.mod.dep("modernnetworking_mc")}")!!
50+
}
51+
52+
loom {
53+
runConfigs.all {
54+
isIdeConfigGenerated = true
55+
runDir = "../../../run"
56+
vmArgs("-Dmixin.debug.export=true", "-XX:+AllowEnhancedClassRedefinition")
57+
}
58+
}
59+
60+
tasks.shadowJar {
61+
configurations = listOf(shadowBundle)
62+
archiveClassifier = "dev-shadow"
63+
exclude("fabric.mod.json", "architectury.common.json")
64+
}
65+
66+
tasks.processResources {
67+
properties(listOf("META-INF/neoforge.mods.toml", "META-INF/mods.toml"),
68+
"mod_id" to mod.id,
69+
"mod_name" to mod.name,
70+
"mod_version" to mod.version,
71+
"mod_description" to mod.prop("description"),
72+
"mod_authors" to mod.prop("authors"),
73+
"minecraft_version_range" to common.mod.prop("mc_dep_forgelike"),
74+
"neoforge_version" to common.mod.dep("neoforge"),
75+
"cloth_config_version" to common.mod.dep("cloth_config"),
76+
"modernnetworking_version" to common.mod.dep("modernnetworking"),
77+
"kotlinlangforge_loader" to common.mod.dep("kotlinlangforge_loader"),
78+
"kotlinlangforge_version" to common.mod.dep("kotlinlangforge")
79+
)
80+
}
81+
82+
tasks.build {
83+
group = "versioned"
84+
description = "Must run through 'chiseledBuild'"
85+
}
86+
87+
tasks.register<Copy>("buildAndCollect") {
88+
group = "versioned"
89+
description = "Must run through 'chiseledBuild'"
90+
from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile)
91+
into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader"))
92+
dependsOn("build")
93+
}

0 commit comments

Comments
 (0)