summaryrefslogtreecommitdiff
path: root/src/main/java/bscv/asm/patches/TestPatch.java
blob: 3d1a9a2cb5e7b7b86023387fbc3c646c9f0c210c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package bscv.asm.patches;

import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.MethodNode;

import bscv.asm.api.IInjector;

/**
 * When working as intended, this patch will crash the game
 * as soon it finished loading with a NegativeArraySizeException.
 */
public class TestPatch {

   public static class FramerateFix implements IInjector, Opcodes {
      public String name()        { return "FramerateFix"; }
      public String targetClass() { return "net.minecraft.client.Minecraft"; }
      public String methodName()  { return "func_213243_aC"; } // getFramerateLimit()
      public String methodDesc()  { return "()I"; }
   
      public void inject(ClassNode clazz, MethodNode main) {
         InsnList insnList = new InsnList();
         insnList.add(new InsnNode(POP));
         main.instructions.insert(insnList);
      }
   }
   

   public static class TickPatch implements IInjector, Opcodes {
      public String name()        { return "TickPatch"; }
      public String targetClass() { return "net.minecraft.client.Minecraft"; }
      public String methodName()  { return "func_71407_l"; } // tick()
      public String methodDesc()  { return "()V"; }
   
      public void inject(ClassNode clazz, MethodNode main) {
         InsnList insnList = new InsnList();
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         insnList.add(new InsnNode(POP));
         main.instructions.insert(insnList);
      }
   }

}