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

## Class ConstructorHead

- java.lang.Object
- - org.spongepowered.asm.mixin.injection.InjectionPoint
  - - org.spongepowered.asm.mixin.injection.points.MethodHead
    - - org.spongepowered.asm.mixin.injection.points.ConstructorHead

-     public class ConstructorHead
      extends MethodHead

  Like `HEAD`, this injection point can be used to specify the first instruction in a method, but provides special handling for constructors. For regular method, the behaviour is identical to `HEAD` .

  By default, this injection point attempts to select the first instruction after any initialisers (including initialisers merged by mixins) but will fall back to selecting the first instruction after the delegate call (eg. a call to `super()` or `this()`) in the case where heuristic detection of the initialisers fails. This behaviour can be overridden by providing the `enforce` parameter to enforce selection of a specific location.

  enforce=POST_DELEGATE
    Select the instruction immediately after the delegate constructor
  enforce=POST_MIXIN
    Select the instruction immediately after all mixin-initialised field initialisers, this is similar to POST_DELEGATE if no applied mixins have initialisers for target class fields, except that the injection point will be after any mixin-supplied initialisers.
  enforce=PRE_BODY
    Selects the first instruction in the target method body, as determined by the line numbers. If the target method does not have line numbers available, the result is equivalent to POST_DELEGATE.

  Example default behaviour:

  >        @At(value = "CTOR_HEAD", unsafe = true)

  Example behaviour enforcing post-delegate injection point:

  >        @At(value = "CTOR_HEAD", unsafe = true, args="enforce=POST_DELEGATE")

- - ### 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
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected ILogger` | `logger` | Logger

    - ### Fields inherited from class org.spongepowered.asm.mixin.injection.InjectionPoint

      `DEFAULT_ALLOWED_SHIFT_BY, MAX_ALLOWED_SHIFT_BY`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConstructorHead​(InjectionPointData data)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `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

    - ### Methods inherited from class org.spongepowered.asm.mixin.injection.points.MethodHead

      `checkPriority`

    - ### 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`

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

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

- - ### Field Detail

    - #### logger

          protected final ILogger logger

      Logger

  - ### Constructor Detail

    - #### ConstructorHead

          public ConstructorHead​(InjectionPointData data)

  - ### Method Detail

    - #### 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
      Overrides:
        `find` in class `MethodHead`
      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