Class MethodHead
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.InjectionPoint
-
- org.spongepowered.asm.mixin.injection.points.MethodHead
-
- Direct Known Subclasses:
ConstructorHead
public class MethodHead extends InjectionPoint
This injection point simply returns the first instruction in the target method body, allowing the injection to be placed at the "head" of the target method. It accepts no parameters and only returns a single insn in all circumstances.
Example:
@At("HEAD")Note that for constructors, use of HEAD is discouraged, see instead
CTOR_HEAD.
-
-
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 Constructor Description MethodHead(InjectionPointData data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckPriority(int targetPriority, int ownerPriority)Runs a priority check in the context of this injection point.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 list-
Methods inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint
addMessage, after, and, before, getAtCode, getId, getSlice, getSpecifier, getTargetRestriction, nextNode, or, parse, parse, parse, parse, parse, parse, parse, parse, register, register, setTargetRestriction, shift, toString
-
-
-
-
Constructor Detail
-
MethodHead
public MethodHead(InjectionPointData data)
-
-
Method Detail
-
checkPriority
public boolean checkPriority(int targetPriority, int ownerPriority)Description copied from class:InjectionPointRuns a priority check in the context of this injection point. A priority check should return true if the injection point is allowed to inject given the relative priorities of the target (a method merged by another mixin with targetPriority) and the incoming mixin with priority mixinPriority.- Overrides:
checkPriorityin classInjectionPoint- Parameters:
targetPriority- Priority of the mixin which originally merged the target method in questionownerPriority- Priority of the mixin which owns the owning injector- Returns:
- true if the priority check succeeds
-
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
-
-