i'm legitimately sorry

This commit is contained in:
Leijurv 2019-02-04 19:01:01 -08:00
parent 90cb11f55e
commit 62b11c0a8a
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 11 additions and 1 deletions

View File

@ -60,7 +60,7 @@ sourceSets {
minecraft { minecraft {
version = '1.12.2' version = '1.12.2'
mappings = 'stable_39' mappings = 'stable_39'
tweakClass = 'org.spongepowered.asm.launch.MixinTweaker' tweakClass = 'baritone.launch.BaritoneTweaker'
runDir = 'run' runDir = 'run'
// The sources jar should use SRG names not MCP to ensure compatibility with all mappings // The sources jar should use SRG names not MCP to ensure compatibility with all mappings

View File

@ -60,12 +60,22 @@ public class Determinizer {
if (entry.getName().equals("META-INF/fml_cache_class_versions.json")) { if (entry.getName().equals("META-INF/fml_cache_class_versions.json")) {
continue; continue;
} }
JarEntry clone = new JarEntry(entry.getName()); JarEntry clone = new JarEntry(entry.getName());
clone.setTime(42069); clone.setTime(42069);
jos.putNextEntry(clone); jos.putNextEntry(clone);
if (entry.getName().endsWith(".refmap.json")) { if (entry.getName().endsWith(".refmap.json")) {
JsonObject object = new JsonParser().parse(new InputStreamReader(jarFile.getInputStream(entry))).getAsJsonObject(); JsonObject object = new JsonParser().parse(new InputStreamReader(jarFile.getInputStream(entry))).getAsJsonObject();
jos.write(writeSorted(object).getBytes()); jos.write(writeSorted(object).getBytes());
} else if (entry.getName().equals("META-INF/MANIFEST.MF")) {
ByteArrayOutputStream cancer = new ByteArrayOutputStream();
copy(jarFile.getInputStream(entry), cancer);
String manifest = new String(cancer.toByteArray());
if (!manifest.contains("baritone.launch.BaritoneTweaker")) {
throw new IllegalStateException("unable to replace");
}
manifest = manifest.replace("baritone.launch.BaritoneTweaker", "org.spongepowered.asm.launch.MixinTweaker");
jos.write(manifest.getBytes());
} else { } else {
copy(jarFile.getInputStream(entry), jos); copy(jarFile.getInputStream(entry), jos);
} }