Package org.spongepowered.asm.mixin.injection.points

## 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 Selector` which 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 class` | `BeforeInvoke.SearchType` | Member 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 boolean` | `allowPermissive` | This option enables a fallback "permissive" search to occur if initial search fails if and only if the `MixinEnvironment.Option.REFMAP_REMAP` option is enabled and the context mixin's parent config has a valid refmap.
    `protected java.lang.String` | `className` | Class name (description) for debug logging
    `protected IInjectionPointContext` | `context` |
    `protected ILogger` | `logger` | Logger reference
    `protected IMixinContext` | `mixin` |
    `protected 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.
    `protected ITargetSelector` | `target` |

    - ### 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 boolean` | `addInsn​(org.objectweb.asm.tree.InsnList insns, java.util.Collection<org.objectweb.asm.tree.AbstractInsnNode> nodes, org.objectweb.asm.tree.AbstractInsnNode insn)` |
    `boolean` | `find​(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
    `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)` |
    `protected void` | `inspectInsn​(java.lang.String desc, org.objectweb.asm.tree.InsnList insns, org.objectweb.asm.tree.AbstractInsnNode insn)` |
    `protected void` | `log​(java.lang.String message, java.lang.Object... params)` |
    `protected boolean` | `matchesInsn​(org.objectweb.asm.tree.AbstractInsnNode insn)` |
    `protected boolean` | `matchesOrdinal​(int ordinal)` |
    `BeforeInvoke` | `setLogging​(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`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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 the `MixinEnvironment.Option.REFMAP_REMAP` option 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: `InjectionPoint`
      Find injection points in the supplied insn list
      Specified by:
        `find` in class `InjectionPoint`
      Parameters:
        `desc` - Method descriptor, supplied to allow return types and arguments etc. to be determined
        `insns` - Insn list to search in, the strategy MUST ONLY add nodes from this list to the `nodes` collection
        `nodes` - 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)