本文整理汇总了Java中net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper类的典型用法代码示例。如果您正苦于以下问题:Java FMLDeobfuscatingRemapper类的具体用法?Java FMLDeobfuscatingRemapper怎么用?Java FMLDeobfuscatingRemapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FMLDeobfuscatingRemapper类属于net.minecraftforge.fml.common.asm.transformers.deobf包,在下文中一共展示了FMLDeobfuscatingRemapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeobfuscated
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
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: parse
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public static BlockMatcher parse(String s) throws Exception {
if (s.startsWith(BaMsConfig.CLASS_PREFIX)) {
String className = s.substring(BaMsConfig.CLASS_PREFIX.length());
className = FMLDeobfuscatingRemapper.INSTANCE.map(className).replace('/', '.');
return new BlockMatcher(Class.forName(className));
}
ResourceLocation name = new ResourceLocation(s);
if (BaMsConfig.ORE_DICT_ID.equals(name.getResourceDomain())) {
return new BlockMatcher(name.getResourcePath());
}
IBlockState state = BlockHelper.parseBlockState(s);
if (state != null) {
return new BlockMatcher(state);
}
return null;
}
示例3: injectData
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
@Override
public void injectData(Map<String, Object> data)
{
liveEnv = (Boolean)data.get("runtimeDeobfuscationEnabled");
cl = (LaunchClassLoader) data.get("classLoader");
File mcDir = (File)data.get("mcLocation");
fmlLocation = (File)data.get("coremodLocation");
ClassPatchManager.INSTANCE.setup(FMLLaunchHandler.side());
FMLDeobfuscatingRemapper.INSTANCE.setup(mcDir, cl, (String) data.get("deobfuscationFileName"));
}
示例4: remapFieldNames
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public static String[] remapFieldNames(String className, String... fieldNames)
{
String internalClassName = FMLDeobfuscatingRemapper.INSTANCE.unmap(className.replace('.', '/'));
String[] mappedNames = new String[fieldNames.length];
int i = 0;
for (String fName : fieldNames)
{
mappedNames[i++] = FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(internalClassName, fName, null);
}
return mappedNames;
}
示例5: getMethodName
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
private static String getMethodName(String context, String name, String desc) {
String deobf = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(context, name, desc);
// do further tweaks to the name for methods that aren't fully deobfuscated by FML
for (int i = 0; i < methodAltNames.length; i++) {
if (methodAltNames[i++].equals(deobf)) { // steps through list two at a time.
deobf = methodAltNames[i]; // this is now the second of the pair.
break;
}
}
// may be the original name if neither FML nor we had any data.
return deobf;
}
示例6: match
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
/**
* Return true if method matches
*
* @param methodName
* @param methodDescription
* @return true or false if not match
*/
public boolean match(String methodName, String methodDescription) {
if (!methodDescription.equals(methodDescription))
return false;
if (methodName.equals(methodMcpName))
return true;
if (!ASMUtil.useSrgNames())
return false;
String mapped = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(clazzName, methodName, methodDescription);
return mapped.equals(methodSrgName);
}
示例7: match
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public boolean match(String methodName, String methodDesc) {
if (!methodDesc.equals(description))
return false;
if (methodName.equals(mcpName))
return true;
if (!ReflectionUtil.useSrgNames())
return false;
String mapped = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(clsName, methodName, methodDesc);
return mapped.equals(srgName);
}
示例8: match
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public boolean match(String fieldName, String fieldDesc) {
if (!fieldDesc.equals(description))
return false;
if (fieldName.equals(mcpName))
return true;
if (!ReflectionUtil.useSrgNames())
return false;
String mapped = FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(clsName, fieldName, fieldDesc);
return mapped.equals(srgName);
}
示例9: applies
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
boolean applies(MethodNode method) {
if (LoadingPlugin.deobfuscatedEnvironment) {
return method.name.equals(mcpName);
} else {
String method_as_srg = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(obfClassName, method.name, method.desc);
return srgName.equals(method_as_srg);
}
}
示例10: setOwner
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public MutateCall setOwner(String owner) {
this.find_mcp_owner = owner.replace(".", "/");
if (!ASMTransformer.dev_environ) {
owner = FMLDeobfuscatingRemapper.INSTANCE.unmap(find_mcp_owner);
}
this.find_notch_owner = owner.replace(".", "/");
return this;
}
示例11: getSuperClass
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public static String getSuperClass(String name, boolean runtime) {
name = toKey(name);
SuperCache cache = declareClass(name);
if (cache == null) {
return "java.lang.Object";
}
cache.flatten();
String s = cache.superclass;
if (!runtime) {
s = FMLDeobfuscatingRemapper.INSTANCE.unmap(s);
}
return s;
}
示例12: match
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public boolean match(String methodName, String methodDesc) {
if (!methodDesc.equals(description)) return false;
if (methodName.equals(mcpName)) return true;
if (!VisitorHelper.useSrgNames()) return false;
String mapped = FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(clsName, methodName, methodDesc);
return mapped.equals(srgName);
}
示例13: match
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
public boolean match(String fieldName, String fieldDesc) {
if (!fieldDesc.equals(description)) return false;
if (fieldName.equals(mcpName)) return true;
if (!VisitorHelper.useSrgNames()) return false;
String mapped = FMLDeobfuscatingRemapper.INSTANCE.mapFieldName(clsName, fieldName, fieldDesc);
return mapped.equals(srgName);
}
示例14: ObfuscatedStateMapper
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
protected ObfuscatedStateMapper() {
LOGGER.info("Using build mapping \"" + ForgeHaxProperties.getMcpMappingUrl() + "\"");
MCPMappingLoader mcpMappingLoader = null;
try {
mcpMappingLoader = new MCPMappingLoader(ForgeHaxProperties.getMcpMappingUrl());
} catch (Exception e) {
LOGGER.error(e.getMessage());
ASMStackLogger.printStackTrace(e);
}
LOGGER.info("Mapping data successfully initialize");
Objects.requireNonNull(mcpMappingLoader, "MCPMappingLoader failed to lookup obfuscation data");
if(isObfuscated())
LOGGER.info("initializing ObfuscatedStateMapper WITH obfuscation");
else
LOGGER.info("initializing ObfuscatedStateMapper WITHOUT obfuscation");
this.mcClasses = ImmutableBiMap.copyOf(FastReflectionForge.Fields.FMLDeobfuscatingRemapper_classNameBiMap.get(FMLDeobfuscatingRemapper.INSTANCE));
this.mcpMethodData = buildMcpTypeData(
mcpMappingLoader.getCsvMethodData(),
mcpMappingLoader.getSrgFileData().class2MethodDataSet,
getConvertedMap(
FastReflectionForge.Fields.FMLDeobfuscatingRemapper_rawMethodMaps.get(FMLDeobfuscatingRemapper.INSTANCE),
str -> str.split("\\(")[0]
),
((csvData, data) -> csvData.getMcpName() + data.getSrgDescriptor())
);
this.mcpFieldData = buildMcpTypeData(
mcpMappingLoader.getCsvFieldData(),
mcpMappingLoader.getSrgFileData().class2FieldDataSet,
getConvertedMap(
FastReflectionForge.Fields.FMLDeobfuscatingRemapper_rawFieldMaps.get(FMLDeobfuscatingRemapper.INSTANCE),
str -> str.split(":")[0]
),
((csvData, data) -> csvData.getMcpName())
);
}
示例15: main
import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; //导入依赖的package包/类
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();
}