-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
262 lines (238 loc) · 9.24 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
255
256
257
258
259
260
261
262
buildscript {
repositories {
// mavenLocal()
maven { url = "https://maven.aliyun.com/nexus/content/groups/public/" }
google()
mavenCentral()
maven {
name = "sponge"
url = "https://repo.spongepowered.org/maven"
}
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'org.spongepowered.mixin'
group = 'huige233'
version = '1.1.4-test225'
minecraft {
version = project.forgeVersion
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = project.mcpVersion
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
def args = [
"-Dmixin.hotSwap=true",
"-Dmixin.debug.export=true",
"-Dmixin.checks.interfaces=true",
// "-Dlegacy.debugClassLoading=true",
// "-Dlegacy.debugClassLoadingFiner=true",
// "-Dlegacy.debugClassLoadingSave=true",
"-Dfml.coreMods.load=huige233.transcend.asm.FMLLoadingPlugin"
]
clientJvmArgs.addAll(args)
serverJvmArgs.addAll(args)
}
repositories {
mavenCentral()
mavenLocal()
maven { url = "https://maven.aliyun.com/nexus/content/groups/public/" }
maven {
name = "buildcraft"
url = "https://mod-buildcraft.com/maven"
}
maven {
url "https://maven.cleanroommc.com"
}
maven {
name = "blamejared"
url = "https://maven.blamejared.com"
}
maven {
name = "CoFH Maven"
url = "https://maven.covers1624.net"
}
maven {
name = "thiakil"
url = "http://maven.thiakil.com"
}
maven {
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven { url "https://maven.hellfiredev.net" }
maven {
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
maven {
name = "ChickenBones Maven"
url = "http://chickenbones.net/maven/"
}
maven { url = "https://repo.spongepowered.org/maven" }
maven {
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven { url = "http://maven.cil.li/" }
maven { url = "https://maven.ellpeck.de/" }
maven { url ="https://www.cursemaven.com"}
// maven {
// //Baubles
// name 'thiakil'
// url 'https://maven.thiakil.com'
// }
maven { url = "file:/${projectDir}/local-repo" }
}
mixin {
add sourceSets.main, "mixins.transcend.refmap.json"
}
dependencies {
implementation 'org.jetbrains:annotations:23.0.0'
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "com.github.mcjty:mcjtylib:${mc_short}-${mcjtylib_version}"
deobfCompile "vazkii.botania:Botania:${botania_version}"
deobfCompile "vazkii.psi:Psi:${psi_version}"
deobfCompile "vazkii.autoreglib:AutoRegLib:${arl_version}"
deobfCompile "com.blamejared:MTLib:${mtlib_version}"
deobfCompile "curse.maven:astralsorcery-${astralsorcery_version}"
deobfCompile "curse.maven:bloodmagic-${bloodmagic_version_curse}"
deobfCompile "curse.maven:thaumcraft-${thaumcraft_version}"
deobfCompile "curse.maven:guideapi-${guideapi_version}"
deobfCompile "curse.maven:mantle-${mantle_build}"
deobfCompile "curse.maven:tconstruct-${tic_build}"
deobfCompile "curse.maven:brandonscore-${bcore_version}"
deobfCompile "curse.maven:draconicevolution-${de_version}"
deobfCompile "curse.maven:redstoneflux-${rf_version}"
deobfCompile "curse.maven:avaritia-${avaritia_version}"
deobfCompile "curse.maven:conarm-${conarm_version}"
deobfCompile("codechicken:CodeChickenLib:${mc_version}-${ccl_version}:universal") {
exclude group: "mezz.jei"
}
//compile fileTree(dir:'libs',includes:['*jar'])
deobfCompile "mods:Baubles:1.12-1.5.2"
//deobfCompile "mods:industrialcraft-2:2.8.188-ex112"
runtimeOnly "mods:industrialcraft-2:2.8.188-ex112"
compileOnly "mods:industrialcraft-2:2.8.188-ex112"
//runtimeOnly "net.industrial-craft:industrialcraft-2:2.8.221-ex112"
//compileOnly "net.industrial-craft:industrialcraft-2:2.8.221-ex112:dev"
deobfCompile "mods:SlashBlade:OHHH"
deobfCompile ("zone.rong:mixinbooter:4.2")
runtime "curse.maven:bwmcore-${bwm_core}"
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include "mcmod.info"
// replace version and mcversion
expand "version": project.version, "mcversion": project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
}
sourceSets {
main {
output.resourcesDir = file('build/combined')
java.outputDir = file('build/combined')
}
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
//from configurations.provided.asFileTree.files.collect {zipTree(it)}
manifest {
attributes([
//"TweakClass": "huige233.transcend.asm.tweaker.Tweaker",
"FMLCorePlugin": "huige233.transcend.asm.FMLLoadingPlugin",
"FMLAT": "transcend_at.cfg",
"MixinConfigs": "mixins.transcend.json",
"FMLCorePluginContainsFMLMod": true
])
}
}
tasks.genIntellijRuns.doFirst {
def workspaceFile = file(".idea/workspace.xml")
workspaceFile.parentFile.mkdirs()
if (!workspaceFile.exists()) {
workspaceFile.write("""\
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunManager">
</component>
</project>
""".stripIndent())
} else {
def workspace = new XmlParser().parse(workspaceFile)
def runManager = workspace.component.findAll({ it.@name == "RunManager" })
if (runManager.size() == 0) {
// When IDEA first imported the project, the RunManager node didn't exist.
workspace.appendNode("component", ["name": "RunManager"])
} else {
// The genIntellijRuns task doesn't delete old run configurations, this is bad.
runManager.each {
it.configuration.findAll({ it.@name == "Minecraft Client" || it.@name == "Minecraft Server" }).each { configuration ->
it.remove(configuration)
}
}
}
new PrintWriter(new FileWriter(workspaceFile)).withCloseable {
new XmlNodePrinter(it).print(workspace)
}
}
}
tasks.genIntellijRuns.doLast {
def workspaceFile = file(".idea/workspace.xml")
def workspace = new XmlParser().parse(workspaceFile)
workspace.component.findAll({ it.@name == "RunManager" }).each {
it.configuration.findAll({ it.@name == "Minecraft Client" || it.@name == "Minecraft Server" }).each {
// The module name specified in the run configuration generated by the genIntellijRuns task is wrong.
// It uses underscores instead of dots.
// https://github.com/MinecraftForge/ForgeGradle/blob/FG_2.3/src/main/java/net/minecraftforge/gradle/user/UserBasePlugin.java#L1325
it.module.@name = project.idea.module.name + '.' + project.minecraft.runSourceSet.name
}
}
new PrintWriter(new FileWriter(workspaceFile)).withCloseable {
new XmlNodePrinter(it).print(workspace)
}
}
import net.minecraftforge.gradle.tasks.DownloadAssetsTask
import sun.misc.SharedSecrets
import sun.misc.Unsafe
// initialize the constant pool and force to load strings so that strings can be replaced
void initConstantPool(Class<?> clazz) {
if (clazz != null && !clazz.interface) {
initConstantPool clazz.superclass
def constantPool = SharedSecrets.javaLangAccess.getConstantPool clazz
for (i in 0..constantPool.size) {
try {
constantPool.getStringAt i
} catch (def ignored) {}
}
}
}
// replace string values in constant pools
void replaceString(String str1, String str2) {
String.class.getDeclaredField "value" with {
it.setAccessible true
it.set str1, str2.toCharArray()
}
}
// https://github.com/MinecraftForge/ForgeGradle/blob/FG_2.3/src/main/java/net/minecraftforge/gradle/tasks/DownloadAssetsTask.java#L189
initConstantPool Unsafe.theUnsafe.allocateInstance(DownloadAssetsTask.GetAssetTask.class).class
replaceString "http://resources.download.minecraft.net/", "https://resources.download.minecraft.net/"
replaceString "http://maven.ic2.player.to/", "https://maven.ic2.player.to/"