-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
218 lines (189 loc) · 6.32 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
buildscript {
dependencies {
classpath 'org.codehaus.groovy:groovy-json:3.0.9'
}
}
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}
base.archivesName = project.archives_base_name
version = project.mod_version + "+mc" + project.minecraft_version
group = project.maven_group
repositories {
mavenCentral()
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/" }
maven { url "https://maven.saps.dev/minecraft" }
maven { url "https://maven.bai.lol/" }
maven { url "https://maven.wispforest.io" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.quiltmc.org/repository/release" }
maven {
url "https://maven.blamejared.com"
content {
includeGroup "com.faux.ingredientextension"
}
}
maven {
url "https://maven.isxander.dev/releases"
content {
includeGroup "dev.isxander"
}
}
maven {
url "http://maven.modmuss50.me/"
allowInsecureProtocol = true
content {
includeGroup "TechReborn"
}
}
maven {
url "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
url "https://jitpack.io"
content {
includeGroupByRegex("com\\.github\\..+")
}
}
}
// toggle this if you need to make a change to allow intellij to refresh
boolean nothing = true
var settings = new Object() {
boolean wthit
boolean megane
boolean modmenu
boolean rei
boolean emi
boolean techReborn
boolean industrialRevolution
boolean modernIndustrialization
boolean jade
}
apply from: "config.gradle", to: settings
dependencies {
minecraft "com.mojang:minecraft:$minecraft_version"
mappings "net.fabricmc:yarn:$yarn_mappings:v2"
modImplementation "net.fabricmc:fabric-loader:$loader_version"
modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:$rei_version"
modCompileOnly "dev.architectury:architectury-fabric:$architectury_version"
modCompileOnly "dev.emi:emi-fabric:$emi_version:api"
modApi "me.shedaniel.cloth:basic-math:0.6.1"
modCompileOnly "com.terraformersmc:modmenu:$modmenu_version"
modImplementation include("dev.isxander:yet-another-config-lib:$yacl_version")
modImplementation annotationProcessor(include("com.github.mattidragon:configtoolkit:$configtoolkit_version"))
// Add generated data to runtime classpath (slightly hacky)
runtimeOnly files("src/main/generated")
if (settings.rei) {
modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:$rei_version"
modRuntimeOnly "dev.architectury:architectury-fabric:$architectury_version"
}
if (settings.emi) {
modRuntimeOnly "dev.emi:emi-fabric:$emi_version"
}
if (settings.modmenu) modRuntimeOnly "com.terraformersmc:modmenu:$modmenu_version"
if (settings.techReborn) modRuntimeOnly "TechReborn:TechReborn-1.21:$tech_reborn_version"
if (settings.modernIndustrialization) modRuntimeOnly "maven.modrinth:modern-industrialization:$modern_industrialization_version"
if (settings.industrialRevolution) modRuntimeOnly "curse.maven:industrial-revolution-391708:$industrial_revolution_version"
// WTHIT and Megane
modCompileOnly "mcp.mobius.waila:wthit-api:fabric-$wthit_version"
if (settings.wthit) {
modRuntimeOnly "mcp.mobius.waila:wthit:fabric-$wthit_version"
}
modCompileOnly "lol.bai.megane:megane-api:$megane_version"
if (settings.megane) {
modRuntimeOnly "lol.bai:badpackets:fabric-0.1.2"
modRuntimeOnly "lol.bai.megane:megane-runtime:$megane_version"
modRuntimeOnly "lol.bai.megane:megane-vanilla:$megane_version"
modRuntimeOnly "lol.bai.megane:megane-api:$megane_version"
}
modCompileOnly "maven.modrinth:jade:$jade_version+fabric"
if (settings.jade) {
modRuntimeOnly "maven.modrinth:jade:$jade_version+fabric"
}
}
loom {
runs {
datagen {
inherit server
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
vmArg "-Dfabric-api.datagen.modid=fabricaeexnihilo"
//vmArg "-Dfabric-api.datagen.strict-validation"
ideConfigGenerated = true
runDir "build/datagen/"
}
}
// Apply datagen at runtime
mods {
fabricaeexnihilo {
sourceSet sourceSets.main
modFiles.from file("src/main/generated")
}
}
}
// Hack to copy dependency overrides to datagen
tasks.register('copyDatagenOverrides', Copy) {
from "run/config/fabric_loader_dependencies.json"
into "build/datagen/config"
}
clean.finalizedBy(tasks.copyDatagenOverrides)
tasks.runDatagen.dependsOn(tasks.copyDatagenOverrides)
// Delete datagen on clean
clean.delete("src/main/generated")
import groovy.json.JsonException
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each { File file ->
try {
file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
} catch (JsonException e) {
throw new RuntimeException("Failed to minify json for $file", e)
}
}
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release.set(21)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${archives_base_name}" }
}
// Copy datagen to jar
dependsOn tasks.runDatagen
from("src/main/generated") {
exclude "README.md"
exclude ".cache"
}
}
publishing {
publications.register("mavenJava", MavenPublication) {
from components.java
}
}