Package cpw.mods.fml.common.asm.transformers.deobf

Examples of cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper


    final String Rsig = "(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/common/util/ForgeDirection;)Z";
    final String Ssig = "(Lnet/minecraft/block/Block;)Z";
    final String Csig = "(III)Lnet/minecraft/block/Block;";
    final String cc = "net/minecraft/block/BlockPane";
    final String fd = "net/minecraftforge/common/util/ForgeDirection";
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    l: {
      MethodNode m = null;
      for (MethodNode n : cn.methods) {
        if (names[0].equals(remapper.mapMethodName(name, n.name, n.desc)) && sig.equals(remapper.mapMethodDesc(n.desc))) {
          m = n;
          break;
        }
      }

      if (m == null)
        break l;

      m.localVariables = null;

      final String[] dirs = {"NORTH", "NORTH", "SOUTH", "SOUTH", "WEST", "WEST", "EAST", "EAST"};
      int di = 0;

      for (int i = 0, e = m.instructions.size(); i < e; ++i) {
        AbstractInsnNode n = m.instructions.get(i);
        if (n.getType() == AbstractInsnNode.METHOD_INSN) {
          MethodInsnNode mn = (MethodInsnNode)n;
          if (n.getOpcode() == INVOKEINTERFACE && n.getNext().getOpcode() == INVOKEVIRTUAL) {
            if (names[2].equals(remapper.mapMethodName(mn.owner, mn.name, mn.desc))) {
              if (Csig.equals(remapper.mapMethodDesc(mn.desc)) &&
                  Ssig.equals(remapper.mapMethodDesc(((MethodInsnNode)mn.getNext()).desc))) {
                m.instructions.insertBefore(n, new FieldInsnNode(GETSTATIC, fd, dirs[di++], 'L'+fd+';'));
                m.instructions.insertBefore(n, new MethodInsnNode(INVOKEVIRTUAL, cc, "canPaneConnectTo", Rsig, false));
                m.instructions.remove(n.getNext());
                m.instructions.remove(n);
              }
View Full Code Here


    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    final String sig = "(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/common/util/ForgeDirection;)Z";
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    l: {
      MethodNode m = null;
      for (MethodNode n : cn.methods) {
        if (names.equals(remapper.mapMethodName(name, n.name, n.desc)) && sig.equals(remapper.mapMethodDesc(n.desc))) {
          m = n;
          break;
        }
      }
View Full Code Here

    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
    String mOwner = remapper.unmap("net/minecraft/client/renderer/texture/TextureManager");

    l: {
      boolean updated = false;
      mc: for (MethodNode m : cn.methods) {
        String mName = remapper.mapMethodName(name, m.name, m.desc);
        if (names[0].equals(mName) && "()V".equals(m.desc)) {
          updated = true;
          for (int i = 0, e = m.instructions.size(); i < e; ++i) {
            AbstractInsnNode n = m.instructions.get(i);
            if (n.getOpcode() == INVOKEVIRTUAL) {
              MethodInsnNode mn = (MethodInsnNode) n;
              if (mOwner.equals(mn.owner) && names[1].equals(remapper.mapMethodName(mn.owner, mn.name, mn.desc)) && "()V".equals(mn.desc)) {
                m.instructions.set(mn, new MethodInsnNode(INVOKESTATIC, "cofh/asm/HooksCore", "tickTextures",
                    "(Lnet/minecraft/client/renderer/texture/ITickable;)V", false));
                break mc;
              }
            }
View Full Code Here

    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    l: {
      boolean updated = false;
      for (MethodNode m : cn.methods) {
        String mName = remapper.mapMethodName(name, m.name, m.desc);
        if (names[0].equals(mName) && "(Z)V".equals(m.desc)) {
          updated = true;
          for (int i = 0, e = m.instructions.size(); i < e; ++i) {
            AbstractInsnNode n = m.instructions.get(i);
            if (n.getOpcode() == RETURN) {
View Full Code Here

    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    l: {
      boolean updated = false;
      MethodNode getEntry = null, containsItem = null;
      for (MethodNode m : cn.methods) {
        String mName = remapper.mapMethodName(name, m.name, m.desc);
        if (names[0].equals(mName) && "(J)I".equals(m.desc)) {
          updated = true;
          for (int i = 0, e = m.instructions.size(); i < e; ++i) {
            AbstractInsnNode n = m.instructions.get(i);
            if (n.getOpcode() == LXOR) {
              m.instructions.insertBefore(n, new LdcInsnNode(new Long(13L)));
              m.instructions.insertBefore(n, new InsnNode(LMUL));
              break;
            }
          }
          if (containsItem != null) {
            break;
          }
        } else if (names[2].equals(mName) && "(J)Z".equals(m.desc)) {
          containsItem = m;
          if (updated) {
            break;
          }
        }
      }

      mc: if (containsItem != null) {
        // { cloning methods to get a different set of instructions to avoid erasing getEntry
        ClassNode clone = new ClassNode(ASM4);
        cr.accept(clone, ClassReader.EXPAND_FRAMES);
        String sig = "(J)Lnet/minecraft/util/LongHashMap$Entry;";
        for (MethodNode m : clone.methods) {
          String mName = remapper.mapMethodName(name, m.name, m.desc);
          if (names[1].equals(mName) && sig.equals(remapper.mapMethodDesc(m.desc))) {
            getEntry = m;
            break;
          }
        }
        // }
View Full Code Here

    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    final String sig = "(III)Z";
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
    final String itemstack = remapper.unmap("net/minecraft/item/ItemStack");

    l: {
      MethodNode m = null;
      for (MethodNode n : cn.methods) {
        if (names[0].equals(remapper.mapMethodName(name, n.name, n.desc)) && sig.equals(n.desc)) {
          m = n;
          break;
        }
      }
View Full Code Here

    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    final String sig = "(Lnet/minecraft/item/ItemStack;IIZ)Z";
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    l: {
      MethodNode m = null;
      for (MethodNode n : cn.methods) {
        if (names[0].equals(remapper.mapMethodName(name, n.name, n.desc)) && sig.equals(remapper.mapMethodDesc(n.desc))) {
          m = n;
          break;
        }
      }
View Full Code Here

    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);

    final String sig = "(Lnet/minecraft/world/storage/ISaveHandler;Ljava/lang/String;Lnet/minecraft/world/WorldProvider;Lnet/minecraft/world/WorldSettings;Lnet/minecraft/profiler/Profiler;)V";
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    MethodNode addTileEntity = null, addTileEntities = null, setTileEntity = null, updateEntities = null;
    boolean found = false;
    for (MethodNode m : cn.methods) {
      if ("<init>".equals(m.name)) {
        if (sig.equals(remapper.mapMethodDesc(m.desc)))
            found = true;
        LabelNode a = new LabelNode(new Label());
        AbstractInsnNode n = m.instructions.getFirst();
        while (n.getOpcode() != INVOKESPECIAL ||
            !((MethodInsnNode)n).name.equals("<init>")) n = n.getNext();
        m.instructions.insert(n, n = a);
        m.instructions.insert(n, n = new LineNumberNode(-15000, a));
        m.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
        m.instructions.insert(n, n = new TypeInsnNode(NEW, "cofh/lib/util/LinkedHashList"));
        m.instructions.insert(n, n = new InsnNode(DUP));
        m.instructions.insert(n, n = new MethodInsnNode(INVOKESPECIAL, "cofh/lib/util/LinkedHashList", "<init>", "()V", false));
        m.instructions.insert(n, n = new FieldInsnNode(PUTFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      } else if ("addTileEntity".equals(m.name) && "(Lnet/minecraft/tileentity/TileEntity;)V".equals(remapper.mapMethodDesc(m.desc))) {
        addTileEntity = m;
      } else if (names[4].equals(remapper.mapMethodName(name, m.name, m.desc)) && "(Ljava/util/Collection;)V".equals(m.desc)) {
        addTileEntities = m;
      } else if (names[5].equals(remapper.mapMethodName(name, m.name, m.desc)) && "(IIILnet/minecraft/tileentity/TileEntity;)V".equals(remapper.mapMethodDesc(m.desc))) {
        setTileEntity = m;
      } else if (names[6].equals(remapper.mapMethodName(name, m.name, m.desc)) && "()V".equals(remapper.mapMethodDesc(m.desc))) {
        updateEntities = m;
      }
    }
    cn.fields.add(new FieldNode(ACC_PRIVATE, "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;", null, null));
    if (addTileEntity != null) {

      LabelNode a = new LabelNode(new Label());
      AbstractInsnNode n;
      addTileEntity.instructions.insert(n = a);
      addTileEntity.instructions.insert(n, n = new LineNumberNode(-15001, a));
      addTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
      addTileEntity.instructions.insert(n, n = new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      addTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 1));
      addTileEntity.instructions.insert(n, n = new MethodInsnNode(INVOKEVIRTUAL, "cofh/lib/util/LinkedHashList", "push", "(Ljava/lang/Object;)Z", false));
      addTileEntity.instructions.insert(n, n = new InsnNode(POP));
    }
    if (setTileEntity != null) {

      LabelNode a = new LabelNode(new Label());
      AbstractInsnNode n = setTileEntity.instructions.getLast();
      while (n.getOpcode() != RETURN) n = n.getPrevious();
      n = n.getPrevious();
      setTileEntity.instructions.insert(n = a);
      setTileEntity.instructions.insert(n, n = new LineNumberNode(-15002, a));
      setTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 0));
      setTileEntity.instructions.insert(n, n = new FieldInsnNode(GETFIELD, "net/minecraft/world/World", "cofh_recentTiles", "Lcofh/lib/util/LinkedHashList;"));
      setTileEntity.instructions.insert(n, n = new VarInsnNode(ALOAD, 4));
      setTileEntity.instructions.insert(n, n = new MethodInsnNode(INVOKEVIRTUAL, "cofh/lib/util/LinkedHashList", "push", "(Ljava/lang/Object;)Z", false));
      setTileEntity.instructions.insert(n, n = new InsnNode(POP));
    }
    if (addTileEntities != null) {
      LabelNode a = new LabelNode(new Label());
      AbstractInsnNode n = addTileEntities.instructions.getFirst();
      for (;;) {
        while (n.getOpcode() != CHECKCAST) n = n.getNext();
        if (remapper.mapType(((TypeInsnNode)n).desc).equals("net/minecraft/tileentity/TileEntity"))
          break;
      }
      addTileEntities.instructions.insert(n, n = a);
      addTileEntities.instructions.insert(n, n = new LineNumberNode(-15003, a));
      addTileEntities.instructions.insert(n, n = new InsnNode(DUP));
View Full Code Here

    }
    name = name.replace('.', '/');
    ClassNode cn = new ClassNode(ASM4);
    cr.accept(cn, ClassReader.EXPAND_FRAMES);
    final String sig = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/world/storage/ISaveHandler;Ljava/lang/String;Lnet/minecraft/world/WorldProvider;Lnet/minecraft/world/WorldSettings;Lnet/minecraft/profiler/Profiler;)V";
    FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;

    l: {
      for (MethodNode m : cn.methods) {
        if ("<init>".equals(m.name) && sig.equals(remapper.mapMethodDesc(m.desc))) {
          break l;
        }
      }

      ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
View Full Code Here

  private static byte[] writeWorldProxy(String name, byte[] bytes, ClassReader cr) {

    ClassNode world = new ClassNode(ASM4);
    {
      FMLDeobfuscatingRemapper remapper = FMLDeobfuscatingRemapper.INSTANCE;
      try {
        ClassReader reader = new ClassReader(LoadingPlugin.loader.getClassBytes(
            remapper.unmap("net/minecraft/world/World").replace('/', '.')));
        reader.accept(new FMLRemappingAdapter(world), ClassReader.SKIP_CODE);
      } catch (Throwable e) {
        Throwables.propagate(e);
      }
    }
View Full Code Here

TOP

Related Classes of cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.