Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AbstractInsnNode sneakFlagNode = findPattern("moveEntity", "sneakFlagNode",
- method.instructions.getFirst(), isPlayerSneakingSig, "xxxxxx??x");
- if(sneakFlagNode != null &&
- sneakFlagNode instanceof JumpInsnNode) {
- // the original label to the jump
- LabelNode jumpToLabel = ((JumpInsnNode) sneakFlagNode).label;
- // the or statement jump if isSneaking returns false
- LabelNode orJump = new LabelNode();
- InsnList insnList = new InsnList();
- insnList.add(new JumpInsnNode(IFNE, orJump)); // if not equal, jump past the ForgeHaxHooks.isSafeWalkActivated
- insnList.add(new FieldInsnNode(GETSTATIC,
- NAMES.IS_SAFEWALK_ACTIVE.getParentClass().getRuntimeName(),
- NAMES.IS_SAFEWALK_ACTIVE.getRuntimeName(),
- NAMES.IS_SAFEWALK_ACTIVE.getTypeDescriptor()
- ));// get the value of isSafeWalkActivated
- insnList.add(new JumpInsnNode(IFEQ, jumpToLabel));
- insnList.add(orJump);
- AbstractInsnNode previousNode = sneakFlagNode.getPrevious();
- method.instructions.remove(sneakFlagNode); // delete IFEQ
- method.instructions.insert(previousNode, insnList); // insert new instructions
- isPatched &= true;
- }
Advertisement
Add Comment
Please, Sign In to add comment