Class JumpInsnPoint
java.lang.Object
org.spongepowered.asm.mixin.injection.InjectionPoint
org.spongepowered.asm.mixin.injection.points.JumpInsnPoint
This injection point searches for JUMP opcodes (if, try/catch, continue,
break, conditional assignment, etc.) with either a particular opcode or at a
particular ordinal in the method body (eg. "the Nth JUMP insn" where N is the
ordinal of the instruction). By default it returns all JUMP instructions in a
method body. It accepts the following parameters from
At:
- opcode
- The
opcodeof the jump instruction, must be one of IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. Defaults to -1 which matches any JUMP opcode. - ordinal
- The ordinal position of the jump insn to match. For example if there are 3 jumps of the specified type and you want to match the 2nd then you can specify an ordinal of 1 (ordinals are zero-indexed). The default value is -1 which supresses ordinal matching
Example:
@At(value = "JUMP", opcode = Opcodes.IFLE, ordinal = 2)
Note that like all standard injection points, this class matches the insn
itself, putting the injection point immediately before the access in
question. Use shift
specifier to adjust the matched opcode as necessary.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
InjectionPoint.AtCode, InjectionPoint.Flags, InjectionPoint.RestrictTargetLevel, InjectionPoint.Specifier -
Field Summary
Fields inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanfind(String desc, org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes) Find injection points in the supplied insn listMethods inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
addMessage, after, and, before, checkPriority, getAtCode, getId, getSlice, getSpecifier, getTargetRestriction, nextNode, or, parse, parse, parse, parse, parse, parse, parse, parse, register, register, setTargetRestriction, shift, toString
-
Constructor Details
-
JumpInsnPoint
-
-
Method Details
-
find
public boolean find(String desc, org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes) Description copied from class:InjectionPointFind injection points in the supplied insn list- Specified by:
findin classInjectionPoint- Parameters:
desc- Method descriptor, supplied to allow return types and arguments etc. to be determinedinsns- Insn list to search in, the strategy MUST ONLY add nodes from this list to thenodescollectionnodes- Collection of nodes to populate. Injectors should NOT make any assumptions about the state of this collection and should only call the add() method- Returns:
- true if one or more injection points were found
-