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
|
import moe.nea.zwirn.plugin.*
plugins {
java
id("moe.nea.zwirn") version "1.0-SNAPSHOT"
}
group = "moe.nea"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://maven.minecraftforge.net") {
this.metadataSources {
artifact()
}
}
maven("https://maven.fabricmc.net")
}
val minecraftVersion = "1.8.9"
val mcpVersion = "22-1.8.9"
val combinedMappingsDir = file("work_mappings")
val overlayMappingsDir = file("mappings")
val mcpSrg = configurations.detachedConfiguration(dependencies.create("de.oceanlabs.mcp:mcp:$minecraftVersion:srg@zip"))
val enigmaSwing = configurations.detachedConfiguration(dependencies.create("cuchaz:enigma-swing:2.4.1:all"))
val mcpStable = configurations.detachedConfiguration(dependencies.create("de.oceanlabs.mcp:mcp_stable:$mcpVersion@zip"))
val downloadMinecraft by tasks.register("downloadMinecraft", DownloadMinecraftTask::class) {
this.minecraftJar.set(layout.buildDirectory.file("minecraft-obf.jar"))
this.version.set(minecraftVersion)
}
val seargeTiny by tasks.register("seargeTiny", ConvertSeargeToTinyTask::class) {
this.srgArchive = mcpSrg
this.srgTinyFile.set(layout.buildDirectory.file("mcpSrg.tiny"))
}
val fixFieldDescriptors by tasks.register("fixFieldDescriptor", FixFieldDescriptorsTask::class) {
this.inputTinyFile.set(seargeTiny.srgTinyFile)
this.outputTinyFile.set(layout.buildDirectory.file("mcpSrgWithFields.tiny"))
this.jarInFirstNamespace.set(downloadMinecraft.minecraftJar)
}
val injectSRGConstructors by tasks.register("injectSrgConstructor", EnrichSeargeWithConstructorsTask::class) {
this.srgArchive = mcpSrg
this.srgTinyFile.set(fixFieldDescriptors.outputTinyFile)
this.enrichedTinyFile.set(layout.buildDirectory.file("mcpEnrichedConstructor.tiny"))
}
val enrichMcp by tasks.register("enrichMcp", EnrichSeargeWithMCPTask::class) {
this.mcpArchive = mcpStable
this.srgTinyFile.set(injectSRGConstructors.enrichedTinyFile)
this.enrichedTinyFile.set(layout.buildDirectory.file("mcpEnriched.tiny"))
}
val generateOverlayTiny by tasks.register("overlayTiny", PackMappingsTask::class) {
this.inputEnigmaDirectory.set(overlayMappingsDir)
this.outputTinyFile.set(layout.buildDirectory.file("overlay.tiny"))
this.obfuscatedNamespace.set("searge")
this.readableNamespace.set("mcp")
}
val mergeMcpAndOverlay by tasks.register("mergeMcpAndOverlay", MergeTinyFilesTask::class) {
this.baseTinyFile.set(enrichMcp.enrichedTinyFile)
this.overlayTinyFile.set(generateOverlayTiny.outputTinyFile)
this.sharedNamespace.set("searge")
this.outputTinyFile.set(layout.buildDirectory.file("mcpCummedOn.tiny"))
}
val tinyFromMergedEnigma by tasks.register("tinyFromMergedEnigma", PackMappingsTask::class) {
this.readableNamespace.set("mcp")
this.obfuscatedNamespace.set("searge")
this.inputEnigmaDirectory.set(combinedMappingsDir)
this.outputTinyFile.set(layout.buildDirectory.file("fromWork.tiny"))
}
val mcpExclusiveBase by tasks.register("mcpExclusiveBase", ReorderNamespacesTask::class) {
this.inputTinyFile.set(enrichMcp.enrichedTinyFile)
this.outputTinyFile.set(layout.buildDirectory.file("mcpExclusiveBase.tiny"))
this.appendNamespaceKeepName("searge")
this.appendNamespaceKeepName("mcp")
}
val generateDiffTiny by tasks.register("generateDiffTiny", DiffTinyFilesTask::class) {
this.mergedTinyFile.set(tinyFromMergedEnigma.outputTinyFile)
this.baseTinyFile.set(mcpExclusiveBase.outputTinyFile)
this.outputTinyFile.set(layout.buildDirectory.file("overlayGenerated.tiny"))
}
val generateMappingPatches by tasks.register("generateMappingPatches", UnpackMappingsTask::class) {
this.inputTinyFile.set(generateDiffTiny.outputTinyFile)
this.outputEnigmaDirectory.set(overlayMappingsDir)
}
val mcpExclusiveMerged by tasks.register("mcpExclusiveMerged", ReorderNamespacesTask::class) {
this.inputTinyFile.set(mergeMcpAndOverlay.outputTinyFile)
this.outputTinyFile.set(layout.buildDirectory.file("mcpExclusiveMerged.tiny"))
this.appendNamespaceKeepName("searge")
this.appendNamespaceKeepName("mcp")
}
val unpackMappings by tasks.register("unpackMappings", UnpackMappingsTask::class) {
this.inputTinyFile.set(mcpExclusiveMerged.outputTinyFile)
this.outputEnigmaDirectory.set(combinedMappingsDir)
}
val mapMinecraft by tasks.register("mapMinecraft", MapJarTask::class) {
this.inputJar = project.files(downloadMinecraft)
this.inputNamespace.set("notch")
this.outputNamespace.set("searge")
this.mappingTinyFile.set(enrichMcp.enrichedTinyFile)
this.outputJar.set(project.layout.buildDirectory.file("minecraft-searge.jar"))
}
val launchEnigma by tasks.register("launchEnigma", JavaExec::class) {
this.classpath(enigmaSwing)
this.mainClass.set("cuchaz.enigma.gui.Main")
dependsOn(mapMinecraft)
this.args(
"--jar",
mapMinecraft.outputJar.get().asFile.absolutePath,
"--mappings",
combinedMappingsDir.absolutePath,
"--no-edit-classes",
"--single-class-tree"
)
}
|