本文整理汇总了Java中net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java FMLDeobfuscatingRemapper.INSTANCE属性的具体用法?Java FMLDeobfuscatingRemapper.INSTANCE怎么用?Java FMLDeobfuscatingRemapper.INSTANCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper
的用法示例。
在下文中一共展示了FMLDeobfuscatingRemapper.INSTANCE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeobfuscated
private Accessor<ObjectType,FieldType> getDeobfuscated(ObjectType objectType) {
Class objectClass = objectType.getClass();
Set<String> obfedClasses = FMLDeobfuscatingRemapper.INSTANCE.getObfedClasses();
for (String readableName: obfedClasses) {
String obfedName = FMLDeobfuscatingRemapper.INSTANCE.map(readableName);
logger.info(readableName+" to "+obfedName);
remapper = FMLDeobfuscatingRemapper.INSTANCE;
Map<String,String> fieldMap = this.fieldAccessor.get(remapper).get(readableName);
if (fieldMap== null) continue;
for (String key: fieldMap.keySet()) {
logger.info(" "+key + " " + fieldMap.get(key));
}
}
while ((objectClass != null)&&(objectClass != Object.class)) {
String deobfuscatedClassName = FMLDeobfuscatingRemapper.INSTANCE.unmap(objectClass.getCanonicalName());
if (deobfuscatedClassName == null) continue;
if (deobfuscatedClassName.equals("")) continue;
deobfuscatedName = FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(deobfuscatedClassName, fieldName, fieldName);
deobfuscated = new Accessor<ObjectType,FieldType>(deobfuscatedName);
}
throw new RuntimeException("Could not remap field "+fieldName+ " in class "+objectType.getClass().getCanonicalName());
}
示例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 = toByteArray(sourceZip, entry);
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();
}