forked from TeamDman/PlusTiC
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
254 lines (219 loc) · 9.87 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}
version = mod_version + '-mc' + minecraft_version
group = mod_group_id
base {
archivesName = mod_id
}
// Mojang ships Java 17 to end users in 1.18+
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: mapping_channel, version: mapping_version
copyIdeResources = true
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
enableIdeaPrepareRuns = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
}
client {
// this block needs to be here for runClient to exist
}
server {
args '--nogui'
}
data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), '--existing-mod', 'tconstruct'
// Ensure dependent mods are loaded when running Minecraft in the IDE
environment 'assetIndex', '{asset_index}'
environment 'assetDirectory', '{assets_root}'
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
// flatDir {
// dir 'libs'
// }
maven {
name "cursemaven"
url 'https://www.cursemaven.com'
content {
includeGroup "curse.maven"
}
}
maven {
name "ProgWML6"
url "https://dvs1.progwml6.com/files/maven"
}
maven {
name "BlameJared"
url "https://maven.blamejared.com"
}
maven {
name "ModMaven"
url "https://modmaven.dev"
}
maven {
name "covers1624"
url "https://maven.covers1624.net"
}
maven {
name "ChaosField"
url "https://maven.chaosfield.at"
}
maven {
name "tehnut"
url "https://tehnut.info/maven"
}
maven {
name "HellFireDev"
url "https://maven.hellfiredev.net"
}
maven {
name "firstdarkdev"
url "https://maven.firstdarkdev.xyz/releases/"
}
maven {
name "TheIllusiveC4"
url "https://maven.theillusivec4.top/"
}
flatDir {
name "local"
dir "libs"
}
}
dependencies {
// Minecraft Forge
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Tinkers' Construct
implementation fg.deobf("slimeknights.tconstruct:TConstruct:${minecraft_version}-${tconstruct_version}")
implementation fg.deobf("slimeknights.mantle:Mantle:${minecraft_version}-${mantle_version}")
// JEI
compileOnly fg.deobf("mezz.jei:jei-${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}")
// Libs for optional mods
// runtimeOnly fg.deobf("curse.maven:scorge-471286:3276638")
// runtimeOnly fg.deobf("local:codechickenlib:${minecraft_version}-4.0.7.445:universal") // "codechicken:CodeChickenLib:1.16.5-4.0.1.426"
// runtimeOnly fg.deobf("local:CBMultipart:${minecraft_version}-3.0.4.123:universal") // "curse.maven:cb-multipart-258426:2755790-deobf-2755791"
// runtimeOnly fg.deobf("local:BrandonsCore:${minecraft_version}-3.0.15.248:universal")
// runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.16.4-53.3") // fg.deobf("curse.maven:patchouli-306770:3847029")
// runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.16.5-4.1.0.1") // fg.deobf("curse.maven:curios-309927:4419403")
// Optional mods
// runtimeOnly fg.deobf("curse.maven:project-red-core-228702:4607539") // "mrtjp:ProjectRed-${minecraft_version}:${projectred_version}:core"
// runtimeOnly fg.deobf("curse.maven:project-red-exploration-229049:4607541") // "mrtjp:ProjectRed-${minecraft_version}:${projectred_version}:exploration"
// runtimeOnly fg.deobf("curse.maven:psi-241665:4458005") // 'vazkii.psi:Psi:1.16-97.474'
// runtimeOnly fg.deobf("vazkii.botania:Botania:1.16.5-420.3") // fg.deobf("curse.maven:botania-225643:4066054")
// runtimeOnly "curse.maven:armorplus-237366:2952741"
// runtimeOnly "curse.maven:thermal-foundation-222880:2926428"
// runtimeOnly fg.deobf("local:Draconic-Evolution:${minecraft_version}-3.0.29.518:universal")
// runtimeOnly fg.deobf("curse.maven:projecte-226410:3736621-api-3736622")
// runtimeOnly fg.deobf("curse.maven:gemsplusplus-310914:3462347")
// runtimeOnly fg.deobf("curse.maven:silents-gems-220311:3353519")
// runtimeOnly fg.deobf("curse.maven:applied-energistics-2-223794:3608871") // "appeng:appliedenergistics2-forge:15.2.8"
// runtimeOnly fg.deobf("curse.maven:industrial-foregoing-266515:2745321-sources-2745322-api-2745323-deobf-2745324") // "com.buuz135:industrial-foregoing:1.20.1-3.5.19"
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project] + [
tconstruct_version: tconstruct_version,
mantle_version: mantle_version,
jei_version: jei_version,
]
}
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name,
'Implementation-Version' : mod_version,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}
java {
withSourcesJar()
}
artifacts {
archives sourcesJar
}
publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
artifact sourcesJar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
options.compilerArgs << "-Xmaxerrs" << "1000" // Show way more compiler errors
}