Class BeforeInvoke
java.lang.Object
org.spongepowered.asm.mixin.injection.InjectionPoint
org.spongepowered.asm.mixin.injection.points.BeforeInvoke
- Direct Known Subclasses:
AfterInvoke,BeforeFieldAccess,BeforeStringInvoke
This injection point searches for INVOKEVIRTUAL, INVOKESTATIC and
INVOKESPECIAL opcodes matching its arguments and returns a list of insns
immediately prior to matching instructions. It accepts the following
parameters from At:
- target
- A
Target Selectorwhich identifies the target method - ordinal
- The ordinal position of the method invocation to match. For example if the method is invoked 3 times and you want to match the 3rd then you can specify an ordinal of 2 (ordinals are zero-indexed). The default value is -1 which supresses ordinal matching
Example:
@At(value = "INVOKE", target="func_1234_a(III)V")
Note that like all standard injection points, this class matches the insn
itself, putting the injection point immediately before the access in
question. Use At.shift() specifier to adjust the matched opcode as
necessary.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumMember search type, the PERMISSIVE search is only used when refmap remapping is enabled.Nested classes/interfaces inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
InjectionPoint.AtCode, InjectionPoint.Flags, InjectionPoint.RestrictTargetLevel, InjectionPoint.Specifier -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanThis option enables a fallback "permissive" search to occur if initial search fails if and only if theMixinEnvironment.Option.REFMAP_REMAPoption is enabled and the context mixin's parent config has a valid refmap.protected final StringClass name (description) for debug loggingprotected final IInjectionPointContextprotected final ILoggerLogger referenceprotected final IMixinContextprotected final intThis strategy can be used to identify a particular invocation if the same method is invoked at multiple points, if this value is -1 then the strategy returns all invocations of the method.protected final ITargetSelectorFields inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanaddInsn(org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, org.objectweb.asm.tree.AbstractInsnNode insn) booleanfind(String desc, org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes) Find injection points in the supplied insn listprotected booleanfind(String desc, org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, ITargetSelector selector, BeforeInvoke.SearchType searchType) protected voidinspectInsn(String desc, org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn) protected voidprotected booleanmatchesInsn(org.objectweb.asm.tree.AbstractInsnNode insn) protected booleanmatchesOrdinal(int ordinal) setLogging(boolean logging) Set the logging state for this injectorMethods 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
-
Field Details
-
target
-
allowPermissive
protected final boolean allowPermissiveThis option enables a fallback "permissive" search to occur if initial search fails if and only if theMixinEnvironment.Option.REFMAP_REMAPoption is enabled and the context mixin's parent config has a valid refmap. -
ordinal
protected final int ordinalThis strategy can be used to identify a particular invocation if the same method is invoked at multiple points, if this value is -1 then the strategy returns all invocations of the method. -
className
Class name (description) for debug logging -
context
-
mixin
-
logger
Logger reference
-
-
Constructor Details
-
BeforeInvoke
-
-
Method Details
-
setLogging
Set the logging state for this injector- Parameters:
logging- logging state- Returns:
- fluent interface
-
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
-
find
protected boolean find(String desc, org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, ITargetSelector selector, BeforeInvoke.SearchType searchType) -
addInsn
protected boolean addInsn(org.objectweb.asm.tree.InsnList insns, Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, org.objectweb.asm.tree.AbstractInsnNode insn) -
matchesInsn
protected boolean matchesInsn(org.objectweb.asm.tree.AbstractInsnNode insn) -
inspectInsn
protected void inspectInsn(String desc, org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn) -
matchesOrdinal
protected boolean matchesOrdinal(int ordinal) -
log
-