Class MixinTargetContext

  • All Implemented Interfaces:
    IMixinContext

    public class MixinTargetContext
    extends java.lang.Object
    implements IMixinContext
    This object keeps track of data for applying a mixin to a specific target class during a mixin application. This is a single-use object which acts as both a handle information we need when applying the mixin (such as the actual mixin ClassNode and the target ClassNode) and a gateway to context-sensitive operations such as re-targetting method and field accesses in the mixin to the appropriate members in the target class hierarchy.
    • Field Detail

      • activities

        protected final ActivityStack activities
        Activity tracker
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getEnvironment

        public MixinEnvironment getEnvironment()
        Get the environment of the owning mixin config
        Returns:
        mixin parent environment
      • getOption

        public boolean getOption​(MixinEnvironment.Option option)
        Description copied from interface: IMixinContext
        Retrieve the value of the specified option from the environment this mixin belongs to.
        Specified by:
        getOption in interface IMixinContext
        Parameters:
        option - option to check
        Returns:
        option value
      • getClassNode

        public org.objectweb.asm.tree.ClassNode getClassNode()
        Get the mixin tree
        Returns:
        mixin tree
      • getClassName

        public java.lang.String getClassName()
        Get the mixin class name
        Specified by:
        getClassName in interface IMixinContext
        Returns:
        the mixin class name
      • getClassRef

        public java.lang.String getClassRef()
        Description copied from interface: IMixinContext
        Get the internal mixin class name
        Specified by:
        getClassRef in interface IMixinContext
        Returns:
        internal class name
      • getTarget

        public org.spongepowered.asm.mixin.transformer.TargetClassContext getTarget()
        Get the target class context
        Returns:
        the target class context
      • getTargetClassName

        public java.lang.String getTargetClassName()
        Get the target class name
        Specified by:
        getTargetClassName in interface IMixinContext
        Returns:
        target class name
      • getTargetClassRef

        public java.lang.String getTargetClassRef()
        Get the target class reference
        Specified by:
        getTargetClassRef in interface IMixinContext
        Returns:
        the reference of the target class (only valid on single-target mixins)
      • getTargetClassNode

        public org.objectweb.asm.tree.ClassNode getTargetClassNode()
        Get the target class
        Returns:
        the target class
      • getTargetClassInfo

        public ClassInfo getTargetClassInfo()
        Get the target classinfo
        Returns:
        the target class info
      • getClassInfo

        public ClassInfo getClassInfo()
        Get the class info for this class
        Returns:
        the local class info
      • getSignature

        public ClassSignature getSignature()
        Get the signature for this mixin class
        Returns:
        signature
      • getStratum

        public SourceMap.File getStratum()
        Get the SourceMap stratum for this mixin
        Returns:
        stratum
      • getMinRequiredClassVersion

        public int getMinRequiredClassVersion()
        Get the minimum required class version for this mixin
      • getDefaultRequiredInjections

        public int getDefaultRequiredInjections()
        Get the defined value for the Inject.require() parameter on injectors defined in mixins in this configuration.
        Returns:
        default require value
      • getDefaultInjectorGroup

        public java.lang.String getDefaultInjectorGroup()
        Get the defined injector group for injectors
        Returns:
        default group name
      • getMaxShiftByValue

        public int getMaxShiftByValue()
        Get the max shift "by" value for the parent config
        Returns:
        max shift by value
      • getInjectorGroups

        public InjectorGroupInfo.Map getInjectorGroups()
        Get the injector groups for this target
        Returns:
        injector groups
      • requireOverwriteAnnotations

        public boolean requireOverwriteAnnotations()
        Get whether overwrite annotations are required for methods in this mixin
        Returns:
        true if overwrite methods must be annoated with Overwrite
      • getTargetMethod

        public Target getTargetMethod​(org.objectweb.asm.tree.MethodNode method)
        Get a target method handle from the target class
        Parameters:
        method - method to get a target handle for
        Returns:
        new or existing target handle for the supplied method
      • requireVersion

        protected void requireVersion​(int version)
        Mark this mixin as requiring the specified class version in the context of the current target
        Parameters:
        version - version to require
      • getPriority

        public int getPriority()
        Get the mixin priority
        Specified by:
        getPriority in interface IMixinContext
        Returns:
        the priority (only meaningful in relation to other mixins)
      • upgradeMethods

        protected void upgradeMethods()
      • upgradeMethodRef

        protected void upgradeMethodRef​(org.objectweb.asm.tree.MethodNode containingMethod,
                                        MemberRef methodRef,
                                        ClassInfo.Method method)