-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
149 lines (131 loc) · 4.53 KB
/
build.gradle.kts
File metadata and controls
149 lines (131 loc) · 4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
plugins {
id("java")
id("fabric-loom") version "latest.release"
id("maven-publish")
}
group = "dev.noeul.fabricmod"
version = property("mod_version")!!
repositories {
mavenCentral()
maven("https://maven.terraformersmc.com/releases")
maven("https://maven.shedaniel.me/")
maven("https://api.modrinth.com/maven") { name = "Modrinth" }
maven("https://jitpack.io")
}
dependencies {
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
mappings("net.fabricmc:yarn:${property("yarn_mappings")}:v2")
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}")
modImplementation("com.terraformersmc:modmenu:${property("mod_menu_version")}")
modRuntimeOnly("maven.modrinth:mixintrace:1.1.1+1.17") // https://modrinth.com/mod/mixintrace/versions
modRuntimeOnly("maven.modrinth:spark:1.10.73-fabric") { // https://modrinth.com/mod/spark/versions
modRuntimeOnly("me.lucko:fabric-permissions-api:0.3.1")
}
modRuntimeOnly("maven.modrinth:language-reload:1.6.1+1.21") // https://modrinth.com/mod/language-reload/versions
modRuntimeOnly("maven.modrinth:ferrite-core:7.0.0") // https://modrinth.com/mod/ferrite-core/versions
modRuntimeOnly("maven.modrinth:auth-me:8.0.0+1.21") { // https://modrinth.com/mod/auth-me/versions
// https://linkie.shedaniel.dev/dependencies?loader=fabric&version=1.21#dep-2
modRuntimeOnly("me.shedaniel.cloth:cloth-config-fabric:15.+")
}
}
loom {
sourceSets.forEach {
it.resources.files
.find { file -> file.name.endsWith(".accesswidener") }
?.let(accessWidenerPath::set)
}
@Suppress("UnstableApiUsage")
mixin {
defaultRefmapName.set("${property("mod_id")}.refmap.json")
}
runs {
getByName("client") {
configName = "Minecraft Client"
runDir = "run/client"
client()
}
getByName("server") {
configName = "Minecraft Server"
runDir = "run/server"
server()
}
}
}
val targetJavaVersion: JavaVersion = JavaVersion.toVersion(property("target_java_version")!!)
java {
targetCompatibility = targetJavaVersion
sourceCompatibility = targetJavaVersion
if (JavaVersion.current() < targetJavaVersion)
toolchain.languageVersion.set(JavaLanguageVersion.of(targetJavaVersion.majorVersion.toInt()))
}
tasks {
compileJava {
if (targetJavaVersion.majorVersion.toInt() >= 10 || JavaVersion.current().isJava10Compatible)
options.release.set(targetJavaVersion.majorVersion.toInt())
this.options.encoding = "UTF-8"
}
processResources {
val inputs = mapOf(
"mod_id" to project.property("mod_id"),
"version" to project.version,
"name" to project.property("mod_name"),
"java_version" to project.property("target_java_version"),
"minecraft_version" to project.property("minecraft_version"),
"loader_version" to project.property("loader_version"),
"fabric_api_version" to project.property("fabric_api_version"),
)
this.inputs.properties(inputs)
filesMatching("fabric.mod.json") {
expand(inputs)
}
}
jar {
from("LICENSE.txt")
archiveBaseName.set("${project.property("archive_base_name")}")
archiveAppendix.set("fabric")
archiveVersion.set("${project.version}+mc${project.property("minecraft_version")}")
}
remapJar {
archiveBaseName.set("${project.property("archive_base_name")}")
archiveAppendix.set("fabric")
archiveVersion.set("${project.version}+mc${project.property("minecraft_version")}")
}
}
afterEvaluate {
loom.runs.configureEach {
vmArgs(
"-Dfabric.systemLibraries=${System.getProperty("java.home")}/lib/hotswap/hotswap-agent.jar",
"-Dfabric.development=true",
"-Dfabric.fabric.debug.deobfuscateWithClasspath",
"-Dmixin.debug.export=true",
"-Dmixin.debug.verify=true",
// "-Dmixin.debug.strict=true",
"-Dmixin.debug.countInjections=true",
"-Dmixin.hotSwap=true",
"-XX:+AllowEnhancedClassRedefinition",
"-XX:HotswapAgent=fatjar",
"-XX:+IgnoreUnrecognizedVMOptions",
"-javaagent:${
configurations.compileClasspath.get()
.files { it.group == "net.fabricmc" && it.name == "sponge-mixin" }
.first()
}"
)
}
}
// configure the maven publication
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}