-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
183 lines (156 loc) · 5.51 KB
/
build.gradle
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
plugins {
id "dev.architectury.loom" version "1.7-SNAPSHOT"
}
def loader = property("loom.platform")
def isFabric = loader == "fabric"
def mcVersion = property("deps.minecraft")
version = property("mod.version") + "-" + mcVersion
group = "dev.imb11"
base {
archivesName = property("mod.name") + "-" + loader
}
sourceSets {
main {
resources {
srcDirs += [
file('src/main/generated')
]
}
}
}
afterEvaluate {
stonecutter {
def platform = property("loom.platform")
stonecutter.const("fabric", platform == "fabric")
stonecutter.const("forge", platform == "forge")
stonecutter.const("neoforge", platform == "neoforge")
}
}
loom {
// TODO: Add a better multi-version AW strategy: https://github.com/IMB11/Sounds/blob/main/build.gradle#L86
accessWidenerPath = getRootProject().file('src/main/resources/fog.accesswidener')
if (loader == "forge") {
forge {
convertAccessWideners = true
mixinConfig "fog.mixins.json"
}
}
if (loader == "fabric" && mcVersion == "1.21.1") {
runs {
datagenClient {
client()
name "Data Generation Client"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=" + getRootDir().toPath().resolve("src/main/generated")
vmArg "-Dfabric-api.datagen.modid=fog"
ideConfigGenerated = false
runDir "build/datagen"
}
}
}
runs {
remove server
}
runConfigs.all {
ideConfigGenerated = true
runDir "../../run"
}
}
repositories {
maven { url "https://maven.neoforged.net/releases/" }
mavenCentral()
mavenLocal()
maven { url = "https://mvn.devos.one/snapshots/" }
maven { url 'https://maven.wispforest.io' }
maven { url 'https://maven.imb11.dev/releases' }
maven { url "https://maven.neoforged.net/releases/" }
maven {
name = "Kotlin For Forge"
url = "https://thedarkcolour.github.io/KotlinForForge"
content { includeGroup "thedarkcolour" }
}
maven {
name 'Xander Maven'
url 'https://maven.isxander.dev/releases'
}
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://maven.quiltmc.org/repository/release" }
maven { url 'https://maven.terraformersmc.com/releases' }
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}
tasks.register('buildAndCollect', Copy) {
group = "build"
from(tasks.remapJar.archiveFile)
into(rootProject.layout.buildDirectory.file("libs"))
dependsOn("build")
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${property("deps.minecraft")}"
mappings(loom.layered {
mappings("net.fabricmc:yarn:${property("deps.yarn")}:v2")
mappings("dev.architectury:yarn-mappings-patch-neoforge:1.21+build.4")
})
modImplementation("dev.architectury:architectury-${loader}:${property("deps.arch_api")}")
modImplementation ("dev.imb11:mru:${property("deps.mru")}+${mcVersion.replace("1.21.1", "1.21").replace("1.21.3", "1.21.4")}+${loader}", {
transitive = false;
})
if (isFabric) {
System.out.println(loader)
modImplementation("net.fabricmc:fabric-loader:${property("deps.fabric_loader")}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${property("runtime.fabric_api")}")
modImplementation("maven.modrinth:modmenu:${property("deps.mod_menu")}")
modImplementation "dev.isxander:yet-another-config-lib:${property("deps.yacl")}-${loader}"
} else {
// YACL stuff
modImplementation "dev.isxander:yet-another-config-lib:${property("deps.yacl")}-${loader}"
if (loader == "forge") {
"forge"("net.minecraftforge:forge:${mcVersion}-${property("deps.fml")}")
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.4.0"))
implementation(include("io.github.llamalad7:mixinextras-forge:0.4.0"))
} else {
"neoForge"("net.neoforged:neoforge:${property("deps.neoforge")}")
}
}
}
processResources {
def props = [
mod_version : version,
target_minecraft: project.property("mod.target"),
target_mru : project.property("deps.mru") + "+" + mcVersion + "+" + loader,
]
if (loader == "forge" || loader == "neoforge") {
props.target_loader = project.property("fml.target")
props.loader = loader
props.mandatory_inclusion_field = (loader == "forge") ? "mandatory = true" : "type = \"required\""
}
props.each { key, value -> inputs.property(key, value) }
if (loader == "fabric") {
filesMatching("fabric.mod.json") { expand(props) }
exclude(["META-INF/neoforge.mods.toml"])
}
if (loader == "neoforge") {
filesMatching(["META-INF/neoforge.mods.toml"]) { expand(props) }
exclude("fabric.mod.json")
}
}
java {
var version = stonecutter.eval(mcVersion, ">1.20.4") ? JavaVersion.VERSION_21 : JavaVersion.VERSION_17
sourceCompatibility = version
targetCompatibility = version
}
jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}" }
}
}