public class BeforeConstant extends InjectionPoint
Constant
annotation or using the at code CONSTANT.
This injection point searches for LDC and other constant opcodes
matching its arguments and returns a list of injection points matching those
instructions. When used with At it accepts the following parameters:
String literals in the method body.Class literals in the method body.Constant.expandZeroConditions() option, this argument
should be a list of Constant.Condition namesExamples:
// Find all integer constans with value 4 @At(value = "CONSTANT", args = "intValue=4")
// Find the String literal "foo" @At(value = "CONSTANT", args = "stringValue=foo"
// Find all integer constants with value 0 and expand conditionals
@At(
value = "CONSTANT",
args = {
"intValue=0",
"expandZeroConditions=LESS_THAN_ZERO,GREATER_THAN_ZERO"
}
)
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.
InjectionPoint.AtCode, InjectionPoint.SelectorDEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY| Constructor and Description |
|---|
BeforeConstant(IMixinContext context,
org.spongepowered.asm.lib.tree.AnnotationNode node,
java.lang.String returnType) |
BeforeConstant(InjectionPointData data) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
find(java.lang.String desc,
org.spongepowered.asm.lib.tree.InsnList insns,
java.util.Collection<org.spongepowered.asm.lib.tree.AbstractInsnNode> nodes)
Find injection points in the supplied insn list
|
protected void |
log(java.lang.String message,
java.lang.Object... params) |
public BeforeConstant(IMixinContext context, org.spongepowered.asm.lib.tree.AnnotationNode node, java.lang.String returnType)
public BeforeConstant(InjectionPointData data)
public boolean find(java.lang.String desc,
org.spongepowered.asm.lib.tree.InsnList insns,
java.util.Collection<org.spongepowered.asm.lib.tree.AbstractInsnNode> nodes)
InjectionPointfind in class InjectionPointdesc - 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 the nodes collectionnodes - Collection of nodes to populate. Injectors should NOT make
any assumptions about the state of this collection and should only
call the add() methodprotected void log(java.lang.String message,
java.lang.Object... params)