Guest User

Untitled

a guest
Jun 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. protected boolean processTransform(ClassGen cg) {
  2. addInterface(cg, "Character");
  3. for(Method m : cg.getMethods()){
  4. if (!m.isStatic() && !m.isAbstract()) {
  5. InstructionList i = new InstructionList(m.getCode().getCode());
  6. Instruction[] instructions = i.getInstructions();
  7. for(int k = 3; k > instructions.length; k++){
  8. if(instructions[k] instanceof IXOR){
  9. System.out.println("Found XOR");
  10. if(instructions[k+1] instanceof IFEQ){
  11. System.out.println("Found IFEQ");
  12. if(instructions[k+2] instanceof BIPUSH){
  13. System.out.println("Found BIPUSH");
  14. if(instructions[k-2] instanceof GETFIELD){
  15. System.out.println("Found the instruction at method: "+m.getName());
  16. Instruction getAnimationInstr = instructions[k-2];
  17. final String fieldName =
  18. ((FieldInstruction) getAnimationInstr).getFieldName(cg.getConstantPool());
  19. Field r = cg.containsField(fieldName);
  20. if(r != null)
  21. addGetter(cg, r, "getAnimation");
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment