summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/ConvertMain.java
diff options
context:
space:
mode:
authorGravatar Cuchaz2015-08-04 12:03:58 -0400
committerGravatar Cuchaz2015-08-04 12:03:58 -0400
commit30b601c690e89e18185c399bd623dfb4fad88ea8 (patch)
treeb5c12163b46fb6faba6c3b234041fe794703e840 /src/cuchaz/enigma/ConvertMain.java
parentadd top 10 matches only button to class matcher (diff)
downloadenigma-fork-30b601c690e89e18185c399bd623dfb4fad88ea8.tar.gz
enigma-fork-30b601c690e89e18185c399bd623dfb4fad88ea8.tar.xz
enigma-fork-30b601c690e89e18185c399bd623dfb4fad88ea8.zip
tweaks to matcher for 1.9 snapshot
Diffstat (limited to 'src/cuchaz/enigma/ConvertMain.java')
-rw-r--r--src/cuchaz/enigma/ConvertMain.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/cuchaz/enigma/ConvertMain.java b/src/cuchaz/enigma/ConvertMain.java
index 1948c84..5ea1bcf 100644
--- a/src/cuchaz/enigma/ConvertMain.java
+++ b/src/cuchaz/enigma/ConvertMain.java
@@ -42,14 +42,16 @@ public class ConvertMain {
42 throws IOException, MappingParseException { 42 throws IOException, MappingParseException {
43 43
44 // init files 44 // init files
45 String inVer = "1.8.3"; 45 String inVer = "1.8.8";
46 String outVer = "1.8.8"; 46 String inSnapshot = null;
47 String outVer = "1.9";
48 String outSnapshot = "15w31c";
47 String side = "client"; 49 String side = "client";
48 File home = new File(System.getProperty("user.home")); 50 File home = new File(System.getProperty("user.home"));
49 JarFile sourceJar = new JarFile(new File(home, ".minecraft/versions/" + inVer + "/" + inVer + ".jar")); 51 JarFile sourceJar = new JarFile(new File(home, getJarPath(inVer, inSnapshot)));
50 JarFile destJar = new JarFile(new File(home, ".minecraft/versions/" + outVer + "/" + outVer + ".jar")); 52 JarFile destJar = new JarFile(new File(home, getJarPath(outVer, outSnapshot)));
51 File inMappingsFile = new File("../Enigma Mappings/" + inVer + "-" + side + ".mappings"); 53 File inMappingsFile = new File("../Enigma Mappings/" + getVersionKey(inVer, inSnapshot, side) + ".mappings");
52 File outMappingsFile = new File("../Enigma Mappings/" + outVer + "-" + side + ".mappings"); 54 File outMappingsFile = new File("../Enigma Mappings/" + getVersionKey(outVer, outSnapshot, side) + ".mappings");
53 Mappings mappings = new MappingsReader().read(new FileReader(inMappingsFile)); 55 Mappings mappings = new MappingsReader().read(new FileReader(inMappingsFile));
54 File classMatchesFile = new File(inVer + "to" + outVer + "-" + side + ".class.matches"); 56 File classMatchesFile = new File(inVer + "to" + outVer + "-" + side + ".class.matches");
55 File fieldMatchesFile = new File(inVer + "to" + outVer + "-" + side + ".field.matches"); 57 File fieldMatchesFile = new File(inVer + "to" + outVer + "-" + side + ".field.matches");
@@ -57,7 +59,7 @@ public class ConvertMain {
57 59
58 // match classes 60 // match classes
59 //computeClassMatches(classMatchesFile, sourceJar, destJar, mappings); 61 //computeClassMatches(classMatchesFile, sourceJar, destJar, mappings);
60 //editClasssMatches(classMatchesFile, sourceJar, destJar, mappings); 62 editClasssMatches(classMatchesFile, sourceJar, destJar, mappings);
61 //convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile); 63 //convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile);
62 64
63 // match fields 65 // match fields
@@ -68,7 +70,21 @@ public class ConvertMain {
68 // match methods/constructors 70 // match methods/constructors
69 //computeMethodMatches(methodMatchesFile, destJar, outMappingsFile, classMatchesFile); 71 //computeMethodMatches(methodMatchesFile, destJar, outMappingsFile, classMatchesFile);
70 //editMethodMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, methodMatchesFile); 72 //editMethodMatches(sourceJar, destJar, outMappingsFile, mappings, classMatchesFile, methodMatchesFile);
71 convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile); 73 //convertMappings(outMappingsFile, sourceJar, destJar, mappings, classMatchesFile, fieldMatchesFile, methodMatchesFile);
74 }
75
76 private static String getJarPath(String version, String snapshot) {
77 if (snapshot != null) {
78 return ".minecraft/versions/" + snapshot + "/" + snapshot + ".jar";
79 }
80 return ".minecraft/versions/" + version + "/" + version + ".jar";
81 }
82
83 private static String getVersionKey(String version, String snapshot, String side) {
84 if (snapshot == null) {
85 return version + "-" + side;
86 }
87 return version + "." + snapshot + "-" + side;
72 } 88 }
73 89
74 private static void computeClassMatches(File classMatchesFile, JarFile sourceJar, JarFile destJar, Mappings mappings) 90 private static void computeClassMatches(File classMatchesFile, JarFile sourceJar, JarFile destJar, Mappings mappings)