-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
166 lines (153 loc) · 5.92 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
//file:noinspection GroovyAssignabilityCheck
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://maven.parchmentmc.org' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${project.forgegradle_version}", changing: true
classpath group: 'org.spongepowered', name: 'mixingradle', version: "${project.mixingradle_version}", changing: true
classpath group: 'org.parchmentmc', name: 'librarian', version: '1.+'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'idea'
repositories {
mavenLocal()
mavenCentral()
maven { //JEI
name = 'ModMaven'
url = 'https://modmaven.dev'
}
maven { //MixinExtras
name = 'Jitpack'
url = 'https://jitpack.io'
}
maven { //Testing
name = 'Curse Maven'
url 'https://cursemaven.com'
}
maven { //Quark
name = 'BlameJared Maven'
url = 'https://maven.blamejared.com'
}
}
group = "${project.mod_group}"
version = "${project.mc_version}-${project.mod_version}"
archivesBaseName = "${project.mod_id}"
java.toolchain.languageVersion = JavaLanguageVersion.of(project.java_version)
configurations {
include { transitive = false }
library
shade
implementation.extendsFrom include
implementation.extendsFrom library
implementation.extendsFrom shade
}
jarJar.enable()
dependencies {
minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}"
implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-common:${project.mixinextras_version}"))
implementation(jarJar("com.github.llamalad7.mixinextras:mixinextras-forge:${project.mixinextras_version}")) {
jarJar.ranged(it, "[${project.mixinextras_version},)")
}
annotationProcessor "org.spongepowered:mixin:${project.mixin_version}:processor"
compileOnly fg.deobf("mezz.jei:jei-${project.mc_version}-common-api:${project.jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${project.mc_version}-forge-api:${project.jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${project.mc_version}-forge:${project.jei_version}")
//runtimeOnly fg.deobf("vazkii.autoreglib:AutoRegLib:${project.autoreglib_version}")
//runtimeOnly fg.deobf("vazkii.quark:Quark:${project.quark_version}")
}
minecraft {
mappings channel: "${project.mappings_channel}", version: "${project.mappings_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=${project.mod_id}.mixins.json"
mods {
propertymodifier {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=${project.mod_id}.mixins.json"
mods {
propertymodifier {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=${project.mod_id}.mixins.json"
args '--mod', "${project.mod_id}", '--all', '--output', file('src/main/generated/'), '--existing', file('src/main/resources/')
mods {
propertymodifier {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/main/generated' }
minecraft.runs.all {
lazyToken('minecraft_classpath') {
configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
processResources {
duplicatesStrategy DuplicatesStrategy.INCLUDE
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'
expand 'mod_id': mod_id, 'mod_name': mod_name,
'mod_version': mod_version, 'mod_url': mod_url,
'mod_updates': mod_updates,
'mod_authors': mod_authors,
'mod_credits': mod_credits,
'mod_description': mod_description,
'mod_logo': mod_logo,
'mc_version_range': mc_version_range,
'forge_version_range': forge_version_range,
'loader_version_range': loader_version_range
}
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml'
}
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
it.text = JsonOutput.toJson(new JsonSlurper().parse(it))
}
}
}
jar {
manifest {
mainAttributes(
"Maven-Artifact": "${project.mod_group}:${project.archivesBaseName}:${project.version}",
"Specification-Title": archivesBaseName,
"Specification-Vendor": "${project.mod_authors}",
"Specification-Version": "1",
"Implementation-Title": "${archivesBaseName}",
"Implementation-Version": "${project.mod_version}",
"Implementation-Vendor": "${project.mod_authors}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Built-On-Java": "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
"Built-On": "${project.mc_version}-${project.forge_version}"
)
}
}
jar.finalizedBy('reobfJar')
mixin {
add sourceSets.main, "${project.mod_id}.refmap.json"
config "${project.mod_id}.mixins.json"
}