本文整理汇总了Java中cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java FMLDeobfuscatingRemapper.INSTANCE属性的具体用法?Java FMLDeobfuscatingRemapper.INSTANCE怎么用?Java FMLDeobfuscatingRemapper.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper
的用法示例。
在下文中一共展示了FMLDeobfuscatingRemapper.INSTANCE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BS4MCTransformer
public BS4MCTransformer() {
srgMappings.put("description", "field_71513_a");
srgMappings.put("cause", "field_71511_b");
srgMappings.put("populateEnvironment", "func_71504_g");
srgMappings.put("getCompleteReport", "func_71502_e");
this.mapper = FMLDeobfuscatingRemapper.INSTANCE;
}
示例2: main
public static void main(String[] args) throws IOException
{
String sourceJar = args[0]; //Clean Vanilla jar minecraft.jar or minecraft_server.jar
String targetDir = args[1]; //Directory containing obfed output classes, typically mcp/reobf/minecraft
String deobfData = args[2]; //Path to FML's deobfusication_data.lzma
String outputDir = args[3]; //Path to place generated .binpatch
String killTarget = args[4]; //"true" if we should destroy the target file if it generated a successful .binpatch
LogManager.getLogger("GENDIFF").log(Level.INFO, String.format("Creating patches at %s for %s from %s", outputDir, sourceJar, targetDir));
Delta delta = new Delta();
FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
remapper.setupLoadOnly(deobfData, false);
JarFile sourceZip = new JarFile(sourceJar);
boolean kill = killTarget.equalsIgnoreCase("true");
File f = new File(outputDir);
f.mkdirs();
for (String name : remapper.getObfedClasses())
{
// Logger.getLogger("GENDIFF").info(String.format("Evaluating path for data :%s",name));
String fileName = name;
String jarName = name;
if (RESERVED_NAMES.contains(name.toUpperCase(Locale.ENGLISH)))
{
fileName = "_"+name;
}
File targetFile = new File(targetDir, fileName.replace('/', File.separatorChar) + ".class");
jarName = jarName+".class";
if (targetFile.exists())
{
String sourceClassName = name.replace('/', '.');
String targetClassName = remapper.map(name).replace('/', '.');
JarEntry entry = sourceZip.getJarEntry(jarName);
byte[] vanillaBytes = entry != null ? ByteStreams.toByteArray(sourceZip.getInputStream(entry)) : new byte[0];
byte[] patchedBytes = Files.toByteArray(targetFile);
byte[] diff = delta.compute(vanillaBytes, patchedBytes);
ByteArrayDataOutput diffOut = ByteStreams.newDataOutput(diff.length + 50);
// Original name
diffOut.writeUTF(name);
// Source name
diffOut.writeUTF(sourceClassName);
// Target name
diffOut.writeUTF(targetClassName);
// exists at original
diffOut.writeBoolean(entry != null);
if (entry != null)
{
diffOut.writeInt(Hashing.adler32().hashBytes(vanillaBytes).asInt());
}
// length of patch
diffOut.writeInt(diff.length);
// patch
diffOut.write(diff);
File target = new File(outputDir, targetClassName+".binpatch");
target.getParentFile().mkdirs();
Files.write(diffOut.toByteArray(), target);
Logger.getLogger("GENDIFF").info(String.format("Wrote patch for %s (%s) at %s",name, targetClassName, target.getAbsolutePath()));
if (kill)
{
targetFile.delete();
Logger.getLogger("GENDIFF").info(String.format(" Deleted target: %s", targetFile.toString()));
}
}
}
sourceZip.close();
}
示例3: main
public static void main(String[] args) throws IOException
{
String sourceJar = args[0]; //Clean Vanilla jar minecraft.jar or minecraft_server.jar
String targetDir = args[1]; //Directory containing obfed output classes, typically mcp/reobf/minecraft
String deobfData = args[2]; //Path to FML's deobfusication_data.lzma
String outputDir = args[3]; //Path to place generated .binpatch
String killTarget = args[4]; //"true" if we should destroy the target file if it generated a successful .binpatch
Logger.getLogger("GENDIFF").log(Level.INFO, String.format("Creating patches at %s for %s from %s", outputDir, sourceJar, targetDir));
Delta delta = new Delta();
FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
remapper.setupLoadOnly(deobfData, false);
JarFile sourceZip = new JarFile(sourceJar);
boolean kill = killTarget.equalsIgnoreCase("true");
File f = new File(outputDir);
f.mkdirs();
for (String name : remapper.getObfedClasses())
{
// Logger.getLogger("GENDIFF").info(String.format("Evaluating path for data :%s",name));
String fileName = name;
String jarName = name;
if (RESERVED_NAMES.contains(name.toUpperCase(Locale.ENGLISH)))
{
fileName = "_"+name;
}
File targetFile = new File(targetDir, fileName.replace('/', File.separatorChar) + ".class");
jarName = jarName+".class";
if (targetFile.exists())
{
String sourceClassName = name.replace('/', '.');
String targetClassName = remapper.map(name).replace('/', '.');
JarEntry entry = sourceZip.getJarEntry(jarName);
byte[] vanillaBytes = entry != null ? ByteStreams.toByteArray(sourceZip.getInputStream(entry)) : new byte[0];
byte[] patchedBytes = Files.toByteArray(targetFile);
byte[] diff = delta.compute(vanillaBytes, patchedBytes);
ByteArrayDataOutput diffOut = ByteStreams.newDataOutput(diff.length + 50);
// Original name
diffOut.writeUTF(name);
// Source name
diffOut.writeUTF(sourceClassName);
// Target name
diffOut.writeUTF(targetClassName);
// exists at original
diffOut.writeBoolean(entry != null);
if (entry != null)
{
diffOut.writeInt(Hashing.adler32().hashBytes(vanillaBytes).asInt());
}
// length of patch
diffOut.writeInt(diff.length);
// patch
diffOut.write(diff);
File target = new File(outputDir, targetClassName+".binpatch");
target.getParentFile().mkdirs();
Files.write(diffOut.toByteArray(), target);
Logger.getLogger("GENDIFF").info(String.format("Wrote patch for %s (%s) at %s",name, targetClassName, target.getAbsolutePath()));
if (kill)
{
targetFile.delete();
Logger.getLogger("GENDIFF").info(String.format(" Deleted target: %s", targetFile.toString()));
}
}
}
sourceZip.close();
}