Search in sources :

Example 1 with FMLRemappingAdapter

use of net.minecraftforge.fml.common.asm.transformers.deobf.FMLRemappingAdapter in project MinecraftForge by MinecraftForge.

the class DeobfuscationTransformer method transform.

// COMPUTE_FRAMES causes classes to be loaded, which could cause issues if the classes do not exist.
// However in testing this has not happened. {As we run post SideTransformer}
// If reported we need to add a custom implementation of ClassWriter.getCommonSuperClass
// that does not cause class loading.
@Override
public byte[] transform(String name, String transformedName, byte[] bytes) {
    if (bytes == null) {
        return null;
    }
    ClassReader classReader = new ClassReader(bytes);
    ClassWriter classWriter = new ClassWriter(WRITER_FLAGS);
    RemappingClassAdapter remapAdapter = new FMLRemappingAdapter(classWriter);
    classReader.accept(remapAdapter, READER_FLAGS);
    return classWriter.toByteArray();
}
Also used : RemappingClassAdapter(org.objectweb.asm.commons.RemappingClassAdapter) FMLRemappingAdapter(net.minecraftforge.fml.common.asm.transformers.deobf.FMLRemappingAdapter) ClassReader(org.objectweb.asm.ClassReader) ClassWriter(org.objectweb.asm.ClassWriter)

Aggregations

FMLRemappingAdapter (net.minecraftforge.fml.common.asm.transformers.deobf.FMLRemappingAdapter)1 ClassReader (org.objectweb.asm.ClassReader)1 ClassWriter (org.objectweb.asm.ClassWriter)1 RemappingClassAdapter (org.objectweb.asm.commons.RemappingClassAdapter)1