Last active
December 18, 2019 16:16
-
-
Save matthewprenger/108265e3efc83181bd2cc2d2fc31a853 to your computer and use it in GitHub Desktop.
Place the new methods.csv and fields.csv in the root of your project (TEMPORARILY, Don't commit these to git!) and add this to the end of your build.gradle and run 'gradle updateMappings`. Updated sources will be placed in src_remapped/main/java. You should do a diff to ensure that they are correct and then replace src/main/java with them.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Important note: Your code must compile on the old mappings, and the obfSourceJar must be enabled (it is by default) | |
1. Download a copy of the new methods.csv and fields.csv from http://export.mcpbot.bspk.rs/ to the root of your project. | |
2. Add the following gradle script to your build.gradle. | |
3. Run 'gradle(w) updateMappings'. | |
4. Do a diff between src/main/java/ and src_remapped/main/java/ to make sure everything looks right. | |
5. replace src/main/java/* with src_remapped/main/java/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task updateMappings(dependsOn: sourceJar) { | |
def remapped = file('src_remapped/main/java') | |
def methods = file('methods.csv') | |
def fields = file('fields.csv') | |
doLast { | |
Map<String, String> map = new HashMap<>() | |
methods.eachLine {line -> | |
String[] pts = line.split(",") | |
map.put(pts[0], pts[1]) | |
} | |
fields.eachLine {line -> | |
String[] pts = line.split(",") | |
map.put(pts[0], pts[1]) | |
} | |
copy { | |
from zipTree(sourceJar.archivePath) | |
into remapped | |
include '**/*.java' | |
filter { javaLine -> | |
map.entrySet().each { entry -> | |
javaLine = javaLine.replace(entry.getKey(), entry.getValue()) | |
} | |
return javaLine | |
} | |
includeEmptyDirs = false | |
eachFile { println "Processing: $it.name" } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, I'm really grateful for the first part of the tutorial, but the second part doesn't works for me. (I guess, because I made a dumb mistake).
The Problem is that sourceJar is not defined and I do not know which value I should assign to sourceJar. (Sorry for my bad english and bad coding skills. Never really worked with gradle.)