Skip to content

Commit 2a43a0f

Browse files
committed
Feature: Quilt
1 parent c534ef7 commit 2a43a0f

File tree

14 files changed

+234
-12
lines changed

14 files changed

+234
-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")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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
object FolderRegister {
7-
val minecraft: File = mc.runDirectory
7+
val minecraft: File = Platform.getGameFolder().toFile()
88
val lambda: File = File(minecraft, "lambda")
99
val config: File = File(lambda, "config")
1010
}

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

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.

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies {
4343
// NeoForge API
4444
neoForge("net.neoforged:neoforge:$neoVersion")
4545

46-
// Architectury API
46+
// Remove the following line if you don't want to depend on the API
4747
modApi("dev.architectury:architectury-neoforge:$architecturyVersion")
4848

4949
// Add dependencies on the required Kotlin modules.

quilt/build.gradle.kts

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
val quiltVersion = property("quilt_version").toString()
2+
val quiltedFabricVersion = property("quilted_fabric_version").toString()
3+
val kotlinQuiltVersion = property("kotlin_quilt_version").toString()
4+
val architecturyVersion = /*property("architectury_version").toString()*/ "10.1.19"
5+
val kotlinxCoroutineVersion = property("kotlinx_coroutines_version").toString()
6+
7+
architectury {
8+
platformSetupLoomIde()
9+
loader("quilt")
10+
}
11+
12+
base.archivesName.set("${base.archivesName.get()}-quilt")
13+
14+
loom {
15+
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
16+
enableTransitiveAccessWideners.set(true)
17+
18+
mods {
19+
register("quilt") {
20+
sourceSet("main", project(":quilt"))
21+
}
22+
}
23+
}
24+
25+
repositories {
26+
maven("https://maven.quiltmc.org/repository/release/")
27+
}
28+
29+
val common: Configuration by configurations.creating {
30+
configurations.compileClasspath.get().extendsFrom(this)
31+
configurations.runtimeClasspath.get().extendsFrom(this)
32+
configurations["developmentQuilt"].extendsFrom(this)
33+
}
34+
35+
val includeLib: Configuration by configurations.creating
36+
val includeMod: Configuration by configurations.creating
37+
38+
fun DependencyHandlerScope.setupConfigurations() {
39+
includeLib.dependencies.forEach {
40+
implementation(it)
41+
include(it)
42+
}
43+
44+
includeMod.dependencies.forEach {
45+
modImplementation(it)
46+
include(it)
47+
}
48+
}
49+
50+
dependencies {
51+
// Quilt Loader
52+
modImplementation("org.quiltmc:quilt-loader:$quiltVersion")
53+
54+
// Quilted Fabric API
55+
modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:$quiltedFabricVersion")
56+
57+
// Remove the following line if you don't want to depend on the API
58+
modApi("dev.architectury:architectury-fabric:$architecturyVersion") {
59+
exclude("net.fabricmc")
60+
exclude("net.fabricmc.fabric-api")
61+
}
62+
63+
// Kotlin for Quilt
64+
modImplementation("org.quiltmc.quilt-kotlin-libraries:quilt-kotlin-libraries:$kotlinQuiltVersion")
65+
66+
// Add dependencies on the required Kotlin modules.
67+
includeLib("org.reflections:reflections:0.10.2")
68+
includeLib("org.javassist:javassist:3.27.0-GA")
69+
70+
// Add mods to the mod jar
71+
// includeMod(...)
72+
73+
74+
// Common (Do not touch)
75+
common(project(":common", configuration = "namedElements")) { isTransitive = false }
76+
shadowCommon(project(":common", configuration = "transformProductionQuilt")) { isTransitive = false }
77+
78+
// Finish the configuration
79+
setupConfigurations()
80+
}
81+
82+
tasks {
83+
processResources {
84+
inputs.property("group", project.group)
85+
inputs.property("version", project.version)
86+
87+
filesMatching("quilt.mod.json") {
88+
expand(getProperties())
89+
expand(mutableMapOf(
90+
"group" to project.group,
91+
"version" to project.version
92+
))
93+
}
94+
}
95+
96+
remapJar {
97+
injectAccessWidener.set(true)
98+
}
99+
}

quilt/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
loom.platform=quilt
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.lambda.fabric
2+
3+
import net.fabricmc.loader.api.FabricLoader
4+
5+
object LoaderInfoImpl {
6+
@JvmStatic
7+
fun getVersion(): String =
8+
FabricLoader.getInstance()
9+
.getModContainer("lambda").orElseThrow()
10+
.metadata.version.friendlyString
11+
}

0 commit comments

Comments
 (0)