generated from GroovyMC/GroovyMDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
197 lines (163 loc) · 6.37 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
import net.minecraftforge.gradle.userdev.tasks.JarJar
import org.moddinginquisiton.gradle.JiJTransformer
plugins {
id 'groovy'
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+' // for Parchment mappings
}
version = '1.19-1.0'
group = 'org.moddinginquisition.elconquistador'
archivesBaseName = 'elconquistador' // your modId - must be lowercase and no spaces.
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
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: 'parchment', version: '1.18.2-2022.07.17-1.19'
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
// applies to all run configs
configureEach {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
elconquistador { // should match archivesBaseName and your modId
source sourceSets.main
}
}
}
client {
property 'forge.enabledGameTestNamespaces', archivesBaseName
}
server {
property 'forge.enabledGameTestNamespaces', archivesBaseName
args '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
property 'forge.enabledGameTestNamespaces', archivesBaseName
}
data {
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', 'elconquistador', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
// Comment this out if you intend on having your mod have both Groovy and Java code
sourceSets.each { sourceSet ->
final javaDir = file("src/${sourceSet.name}/java/")
javaDir.deleteDir()
}
// Required stuff for the `library` dependency type, which is used to include non-mod type dependencies (such as language providers).
configurations {
library
implementation.extendsFrom library
}
minecraft.runs.all {
lazyToken('minecraft_classpath') {
configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
repositories {
// maven {
// name = 'BlameJared'
// url = 'https://maven.blamejared.com'
// }
maven {
name = 'Modding Inquisition Releases'
url = 'https://maven.moddinginquisition.org/releases'
}
maven {
name = 'Modding Inquisition Snapshots'
url = 'https://maven.moddinginquisition.org/snapshots'
}
}
jarJar.enable()
final var jijTransform = Attribute.of('jijTransform', Boolean)
dependencies {
attributesSchema {
attribute jijTransform
}
artifactTypes.getByName('jar') {
attributes.attribute(jijTransform, false)
}
registerTransform(JiJTransformer) {
from.attribute(jijTransform, false).attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.JAR_TYPE)
to.attribute(jijTransform, true).attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.JAR_TYPE)
}
}
configurations {
aplp {
canBeConsumed = false
canBeResolved = true
attributes.attribute jijTransform, true
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.19.2-43.0.0'
final String aplpVersion = '1.1.2'
compileOnly "net.thesilkminer.mc.austin:aplp-1.19:$aplpVersion"
runtimeOnly "net.thesilkminer.mc.austin:aplp-1.19:$aplpVersion"
aplp(group: 'net.thesilkminer.mc.austin', name: "aplp-1.19", version: "[$aplpVersion,)", classifier: 'all')
implementation fg.deobf('ga.ozli.minecraftmods.groovylicious:Groovylicious:1.19.2-0.2.0-SNAPSHOT')
jarJar 'ga.ozli.minecraftmods.groovylicious:Groovylicious:[1.19.2-0.2.0-SNAPSHOT,)'
final String sparkVer = '1.1.0'
compileOnly "me.lucko.spark:spark-api:$sparkVer"
compileOnly "me.lucko.spark:spark-proto:$sparkVer"
runtimeOnly fg.deobf("me.lucko.spark:spark-forge:$sparkVer")
jarJar "me.lucko.spark:spark-forge:[$sparkVer,)"
}
tasks.named('jar', Jar) {
manifest {
attributes([
"Specification-Title" : archivesBaseName,
"Specification-Vendor" : "TheModdingInquisition",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "TheModdingInquisition",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
// This is the preferred method to re-obfuscate your jar file
finalizedBy 'reobfJar'
}
afterEvaluate {
final resolvedFiles = configurations.aplp.resolve()
final aplpJar = resolvedFiles.stream().findFirst().orElseThrow()
tasks.named('jarJar', JarJar) {
it.configuration project.configurations.aplp
it.finalizedBy 'reobfJarJar'
it.doLast {
JiJTransformer.doJijLast(it, aplpJar, project)
}
}
}
reobf {
jarJar {}
}
// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}
tasks.withType(GroovyCompile).configureEach {
groovyOptions.encoding = 'UTF-8' // Use the UTF-8 charset for Groovy compilation
groovyOptions.optimizationOptions.indy = true
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}