Class BeforeInvoke
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.InjectionPoint
-
- org.spongepowered.asm.mixin.injection.points.BeforeInvoke
-
- Direct Known Subclasses:
AfterInvoke,BeforeFieldAccess,BeforeStringInvoke
public class BeforeInvoke extends InjectionPoint
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 Classes Modifier and Type Class Description static classBeforeInvoke.SearchTypeMember 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
Fields Modifier and Type Field Description protected booleanallowPermissiveThis 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 java.lang.StringclassNameClass name (description) for debug loggingprotected IInjectionPointContextcontextprotected ILoggerloggerLogger referenceprotected IMixinContextmixinprotected intordinalThis 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 ITargetSelectortarget-
Fields inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY
-
-
Constructor Summary
Constructors Constructor Description BeforeInvoke(InjectionPointData data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddInsn(org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, org.objectweb.asm.tree.AbstractInsnNode insn)booleanfind(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes)Find injection points in the supplied insn listprotected booleanfind(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, ITargetSelector selector, BeforeInvoke.SearchType searchType)protected voidinspectInsn(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn)protected voidlog(java.lang.String message, java.lang.Object... params)protected booleanmatchesInsn(org.objectweb.asm.tree.AbstractInsnNode insn)protected booleanmatchesOrdinal(int ordinal)BeforeInvokesetLogging(boolean logging)Set the logging state for this injector-
Methods 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 Detail
-
target
protected final ITargetSelector target
-
allowPermissive
protected final boolean allowPermissive
This 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 ordinal
This 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
protected final java.lang.String className
Class name (description) for debug logging
-
context
protected final IInjectionPointContext context
-
mixin
protected final IMixinContext mixin
-
logger
protected final ILogger logger
Logger reference
-
-
Constructor Detail
-
BeforeInvoke
public BeforeInvoke(InjectionPointData data)
-
-
Method Detail
-
setLogging
public BeforeInvoke setLogging(boolean logging)
Set the logging state for this injector- Parameters:
logging- logging state- Returns:
- fluent interface
-
find
public boolean find(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.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(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, ITargetSelector selector, BeforeInvoke.SearchType searchType)
-
addInsn
protected boolean addInsn(org.objectweb.asm.tree.InsnList insns, java.util.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(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn)
-
matchesOrdinal
protected boolean matchesOrdinal(int ordinal)
-
log
protected void log(java.lang.String message, java.lang.Object... params)
-
-