Skip to content

Commit

Permalink
Fix: new Forge Installer will terminate main process
Browse files Browse the repository at this point in the history
  • Loading branch information
xfl03 committed Feb 2, 2023
1 parent 5bf1b95 commit d17808e
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -35,10 +35,21 @@ protected MainMethodVisitor(int api, MethodVisitor methodVisitor) {

@Override
public void visitFieldInsn(int opcode, String owner, String name, String descriptor) {
// Change Actions.SERVER -> Actions.CLIENT
if (opcode == Opcodes.GETSTATIC && name.equals("SERVER")) {
name = "CLIENT";
}
super.visitFieldInsn(opcode, owner, name, descriptor);
}

@Override
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
// Remove System.exit
if (opcode == Opcodes.INVOKESTATIC && name.equals("exit")) {
super.visitInsn(Opcodes.POP);
return;
}
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
}
}
}

0 comments on commit d17808e

Please sign in to comment.