Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ASMAPI methods to assist in working with instruction indexes #69

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
stray javadoc cleanup + injectMethodCall change
Jonathing committed Dec 23, 2024
commit 72ab24c7d695b56c74fc94be401fc2162df2d6a2
7 changes: 4 additions & 3 deletions src/main/java/net/minecraftforge/coremod/api/ASMAPI.java
Original file line number Diff line number Diff line change
@@ -112,6 +112,7 @@ public static boolean insertInsn(MethodNode method, MethodType type, String owne
* Inserts/replaces an instruction list, with respect to the given {@link InsertMode}, on the given instruction.
*
* @param method The method to insert the list into
* @param insn The instruction where the list should be inserted into
* @param list The list to be inserted
* @param mode How the list should be inserted
* @return {@code true} if the list was inserted, {@code false} otherwise
@@ -163,7 +164,7 @@ public static boolean insertInsnList(MethodNode method, MethodType type, String
* @param insn The method call to inject
*/
public static void injectMethodCall(MethodNode method, MethodInsnNode insn) {
method.instructions.insertBefore(method.instructions.getFirst(), insn);
ASMAPI.insertInsn(method, method.instructions.getFirst(), insn, InsertMode.INSERT_BEFORE);
}

/**
@@ -418,7 +419,7 @@ public int get() {

/**
* Finds the first method call in the given method matching the given type, owner, name and descriptor after the
* instruction given index.
* given index.
*
* @param method the method to search in
* @param type the type of method call to search for
@@ -484,7 +485,7 @@ public int get() {

/**
* Finds the first field call in the given method matching the given opcode, owner, name and descriptor after the
* instruction given index.
* given index.
*
* @param method the method to search in
* @param opcode the opcode of field call to search for