Skip to content

Commit 43f235b

Browse files
authored
Merge pull request #2 from Avanatiker/refactor/buildscript
Feature: Quilt mod loader
2 parents 337de2c + 5dd0f02 commit 43f235b

File tree

18 files changed

+254
-12
lines changed

18 files changed

+254
-12
lines changed

build.gradle.kts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ subprojects {
2626
apply(plugin = "org.jetbrains.dokka")
2727

2828
dependencies {
29-
"minecraft"("com.mojang:minecraft:$minecraftVersion")
30-
"mappings"("net.fabricmc:yarn:$yarnMappings:v2")
29+
if (path == ":quilt") {
30+
"minecraft"("com.mojang:minecraft:1.20.2")
31+
"mappings"("net.fabricmc:yarn:1.20.2+build.3:v2")
32+
}
33+
else {
34+
"minecraft"("com.mojang:minecraft:$minecraftVersion")
35+
"mappings"("net.fabricmc:yarn:$yarnMappings:v2")
36+
}
3137
}
3238

3339
if (path == ":common") return@subprojects
@@ -62,6 +68,7 @@ allprojects {
6268
apply(plugin = "architectury-plugin")
6369
apply(plugin = "maven-publish")
6470
apply(plugin = "org.jetbrains.kotlin.jvm")
71+
6572
base.archivesName.set(modId)
6673
group = mavenGroup
6774
version = modVersion
@@ -78,7 +85,9 @@ allprojects {
7885
}
7986

8087
java {
81-
// withSourcesJar() // Uncomment this line when the plugin system is ready
88+
// Uncomment these lines when the plugin system is ready
89+
// withSourcesJar()
90+
// withJavadocJar()
8291

8392
sourceCompatibility = JavaVersion.VERSION_17
8493
targetCompatibility = JavaVersion.VERSION_17

common/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
val fabricLoaderVersion = property("fabric_loader_version").toString()
22
val fabricKotlinVersion = property("fabric_kotlin_version").toString()
33
val mixinExtrasVersion = property("mixinextras_version").toString()
4-
val kotlinXCoroutineVersion = property("kotlinx_coroutines_version").toString()
4+
val architecturyVersion = property("architectury_version").toString()
55

6-
architectury { common("fabric", "forge", "neoforge") }
6+
architectury { common("fabric", "forge", "neoforge", "quilt") }
77

88
loom {
99
silentMojangMappingsLicense()
@@ -23,6 +23,9 @@ dependencies {
2323
// Do NOT use other classes from fabric loader
2424
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
2525

26+
// Remove the following line if you don't want to depend on the API
27+
modApi("dev.architectury:architectury:$architecturyVersion")
28+
2629
// Add dependencies on the required Kotlin modules.
2730
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")
2831
implementation("org.reflections:reflections:0.10.2")

common/src/main/kotlin/com/lambda/util/FolderRegister.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.lambda.util
22

3-
import com.lambda.Lambda.mc
3+
import dev.architectury.platform.Platform
44
import java.io.File
55

66
/**
@@ -11,7 +11,7 @@ import java.io.File
1111
* @property config The directory for storing configuration files, located within the Lambda directory.
1212
*/
1313
object FolderRegister {
14-
val minecraft: File = mc.runDirectory
14+
val minecraft: File = Platform.getGameFolder().toFile()
1515
val lambda: File = File(minecraft, "lambda")
1616
val config: File = File(lambda, "config")
1717
}

fabric/build.gradle.kts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
val fabricLoaderVersion = property("fabric_loader_version").toString()
22
val fabricApiVersion = property("fabric_api_version").toString()
33
val fabricKotlinVersion = property("fabric_kotlin_version").toString()
4+
val architecturyVersion = property("architectury_version").toString()
45

56
architectury {
67
platformSetupLoomIde()
@@ -37,7 +38,12 @@ fun DependencyHandlerScope.setupConfigurations() {
3738
dependencies {
3839
// Fabric API (Do not touch)
3940
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
40-
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
41+
modApi("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
42+
43+
// Remove the following line if you don't want to depend on the API
44+
modApi("dev.architectury:architectury-fabric:$architecturyVersion")
45+
46+
// Kotlin for Fabric
4147
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")
4248

4349
// Add dependencies on the required Kotlin modules.
@@ -49,18 +55,23 @@ dependencies {
4955

5056
// Common (Do not touch)
5157
common(project(":common", configuration = "namedElements")) { isTransitive = false }
52-
shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false }
58+
shadowCommon(project(":common", configuration = "transformProductionFabric")) { isTransitive = false }
5359

5460
// Finish the configuration
5561
setupConfigurations()
5662
}
5763

5864
tasks {
5965
processResources {
66+
inputs.property("group", project.group)
6067
inputs.property("version", project.version)
68+
6169
filesMatching("fabric.mod.json") {
6270
expand(getProperties())
63-
expand(mutableMapOf("version" to project.version))
71+
expand(mutableMapOf(
72+
"group" to project.group,
73+
"version" to project.version
74+
))
6475
}
6576
}
6677

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"depends": {
2929
"fabricloader": ">=0.14.24",
3030
"fabric-api": ">=0.83.0+1.20",
31+
"architectury": ">=9.0.6",
3132
"minecraft": ">=1.20.0",
3233
"java": ">=17",
3334
"fabric-language-kotlin": ">=${fabric_kotlin_version}"

forge/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dependencies {
6464
// Forge API
6565
forge("net.minecraftforge:forge:$forgeVersion")
6666

67-
// Architectury API
67+
// Remove the following line if you don't want to depend on the API
6868
modApi("dev.architectury:architectury-forge:$architecturyVersion")
6969

7070
// Add dependencies on the required Kotlin modules.

forge/src/main/resources/META-INF/mods.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,10 @@ mandatory = true
3232
versionRange = "[4,)"
3333
ordering = "AFTER"
3434
side = "CLIENT"
35+
36+
[[dependencies.lambda]]
37+
modId = "architectury"
38+
mandatory = true
39+
versionRange = "[7.1.86,)"
40+
ordering = "AFTER"
41+
side = "CLIENT"

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ kotlin_forge_version=4.10.0
2727
# NeoForge https://neoforged.net
2828
neo_version=20.4.196
2929

30+
# Quilt https://quiltmc.org/
31+
quilt_version=0.24.0
32+
quilted_fabric_version=8.0.0-alpha.4+0.91.6-1.20.2
33+
kotlin_quilt_version=3.0.0+kt.1.9.22+flk.1.10.17
34+
3035
# Kotlin https://kotlinlang.org/
3136
kotlin.code.style=official
3237

neoforge/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
val neoVersion = property("neo_version").toString()
22
val kotlinForgeVersion = property("kotlin_forge_version").toString()
3+
val architecturyVersion = property("architectury_version").toString()
34
val mixinExtrasVersion = property("mixinextras_version").toString()
45

56
architectury {
@@ -42,6 +43,9 @@ dependencies {
4243
// NeoForge API
4344
neoForge("net.neoforged:neoforge:$neoVersion")
4445

46+
// Remove the following line if you don't want to depend on the API
47+
modApi("dev.architectury:architectury-neoforge:$architecturyVersion")
48+
4549
// Add dependencies on the required Kotlin modules.
4650
// includeLib(...)
4751

neoforge/src/main/kotlin/com/lambda/neoforge/LambdaNeoForge.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import com.lambda.Lambda.VERSION
1010
object LambdaNeoForge {
1111
init {
1212
Lambda.initialize()
13-
LOG.info("$MOD_NAME Fabric $VERSION initialized.")
13+
LOG.info("$MOD_NAME NeoForge $VERSION initialized.")
1414
}
1515
}

0 commit comments

Comments
 (0)