-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
244 lines (209 loc) · 8.52 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
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'me.modmuss50.mod-publish-plugin' version '0.4.5'
}
def secrets = new Properties()
file("./secrets.properties").withInputStream {
stream -> secrets.load(stream)
}
loom {
mods {
"${mod_id}" {
sourceSet sourceSets.main
}
}
runs {
// This adds a new gradle task that runs the datagen API: "gradlew runDatagen"
datagen {
client()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
vmArg "-Dfabric-api.datagen.modid=${mod_id}"
vmArg "-Dporting_lib.datagen.existing_resources=${file("src/main/resources")}"
runDir "run-data"
}
server {
server()
runDir "run-server"
}
}
}
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you enable this line, sources will be generated.
//withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
// 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
maven {
name = 'tterrag maven'
url = 'https://maven.tterrag.com/'
}
maven {
// location of the maven that hosts JEI files before January 2023
name = "Progwml6's maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.dev"
}
maven {
url = "https://cursemaven.com"
}
// Fabric-specific
mavenCentral()
maven {
url = 'https://maven.parchmentmc.org'
}
maven {
url = "https://mvn.devos.one/snapshots/"
}
maven {
url = "https://cursemaven.com"
}
maven {
url = "https://jitpack.io"
}
maven { // Reach Entity Attributes
url = "https://maven.jamieswhiteshirt.com/libs-release"
content { includeGroup("com.jamieswhiteshirt") }
}
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
}
dependencies {
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.layered() {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${mapping_version}@zip")
}
modImplementation "net.fabricmc:fabric-loader:${loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
modImplementation("net.fabricmc.fabric-api:fabric-api-deprecated:$fabric_version")
modImplementation("com.tterrag.registrate_fabric:Registrate:${registrate_version}")
modImplementation("com.jozufozu.flywheel:flywheel-fabric-${flywheel_minecraft_version}:${flywheel_version}")
modImplementation("com.jamieswhiteshirt:reach-entity-attributes:$reach_entity_attributes_version")
modCompileOnly("com.simibubi.create:create-fabric-${create_minecraft_version}:${create_version}") { transitive = false }
modRuntimeOnly("com.simibubi.create:create-fabric-${create_minecraft_version}:${create_version}")
for (String module in port_lib_modules.split(",")) {
modImplementation("io.github.fabricators_of_create.Porting-Lib:$module:$port_lib_version")
}
modImplementation("curse.maven:forge-config-api-port-fabric-547434:$config_api_file_id")
// Example mod dependency with JEI - using the mod prefix ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compile against the JEI API but do not include it at runtime
modCompileOnly("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}")
modCompileOnly("mezz.jei:jei-${jei_minecraft_version}-fabric-api:${jei_version}")
// at runtime, use the full JEI jar for fabric
modRuntimeOnly("mezz.jei:jei-${jei_minecraft_version}-fabric:${jei_version}")
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// 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 {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range : minecraft_version_range,
loader_version_range : loader_version_range,
config_api_version_range: config_api_version_range,
create_version_range : create_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(['fabric.mod.json', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
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' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs" : "create_power_loader.mixins.json"
])
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
tasks.publishMods.dependsOn(tasks.assemble)
tasks.publishMods.mustRunAfter(tasks.build)
wrapper {
gradleVersion = '8.4'
distributionType = Wrapper.DistributionType.BIN
}
publishMods {
changelog = "Check out the detailed changelog at https://github.com/hlysine/create_power_loader/blob/fabric/CHANGELOG.md"
type = BETA
file = tasks.remapJar.archiveFile
modLoaders.add("fabric")
github {
accessToken = secrets.GITHUB_TOKEN
repository = "hlysine/create_power_loader"
commitish = "fabric"
}
modrinth {
accessToken = secrets.MODRINTH_TOKEN
projectId = "E9MuZ1zB"
minecraftVersions.add(minecraft_version)
requires {
id = "LNytGWDc"
}
optional {
id = "u6dRKJwZ"
}
}
curseforge {
accessToken = secrets.CURSEFORGE_TOKEN
projectId = "976304"
minecraftVersions.add(minecraft_version)
}
}