Class MixinConfig

java.lang.Object
org.spongepowered.asm.mixin.transformer.MixinConfig
All Implemented Interfaces:
Comparable<MixinConfig>, IMixinConfig

public final class MixinConfig extends Object implements Comparable<MixinConfig>, IMixinConfig
Mixin configuration bundle
  • Method Details

    • getHandle

      public Config getHandle()
      Get marshalling handle
    • isRequired

      public boolean isRequired()
      Description copied from interface: IMixinConfig
      True if this mixin is required (failure to apply a defined mixin is an error condition).
      Specified by:
      isRequired in interface IMixinConfig
      Returns:
      true if this config is marked as required
    • getEnvironment

      public MixinEnvironment getEnvironment()
      Description copied from interface: IMixinConfig
      Get the parent environment of this config
      Specified by:
      getEnvironment in interface IMixinConfig
      Returns:
      the parent environment
    • getName

      public String getName()
      Description copied from interface: IMixinConfig
      Get the name of the file from which this configuration object was initialised
      Specified by:
      getName in interface IMixinConfig
      Returns:
      the config filename (resource name)
    • getMixinPackage

      public String getMixinPackage()
      Get the package containing all mixin classes
      Specified by:
      getMixinPackage in interface IMixinConfig
      Returns:
      the base package name for this config
    • getPriority

      public int getPriority()
      Get the priority
      Specified by:
      getPriority in interface IMixinConfig
      Returns:
      the priority
    • getVersion

      public String getVersion()
    • getDefaultMixinPriority

      public int getDefaultMixinPriority()
      Get the default priority for mixins in this config. Values specified in the mixin annotation still override this value
    • 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 String getDefaultInjectorGroup()
      Get the defined injector group for injectors
      Returns:
      default group name
    • conformOverwriteVisibility

      public boolean conformOverwriteVisibility()
      Get whether visibility levelfor overwritten methods should be conformed to the target class
      Returns:
      true if conform is enabled
    • requireOverwriteAnnotations

      public boolean requireOverwriteAnnotations()
      Get whether Overwrite annotations are required to enable overwrite behaviour for mixins in this config
      Returns:
      true to require overwriting methods to be annotated
    • getMaxShiftByValue

      public int getMaxShiftByValue()
      Get the maximum allowed value of At.by(). High values of shift can indicate very brittle injectors and in general should be replaced with slices. This value determines the warning/error threshold (behaviour determined by the environment) for the value of by.
      Returns:
      defined shift warning threshold for this config
    • select

      public boolean select​(MixinEnvironment environment)
    • getClasses

      public List<String> getClasses()
      Get the list of mixin classes we will be applying
    • shouldSetSourceFile

      public boolean shouldSetSourceFile()
      Get whether to propogate the source file attribute from a mixin onto the target class
    • getReferenceMapper

      public IReferenceMapper getReferenceMapper()
      Get the reference remapper for injectors
    • getPlugin

      public IMixinConfigPlugin getPlugin()
      Description copied from interface: IMixinConfig
      Get the companion plugin, if available
      Specified by:
      getPlugin in interface IMixinConfig
      Returns:
      the companion plugin instance or null if no plugin
    • getTargetsSet

      public Set<String> getTargetsSet()
      Returns a mutable view of the targets set, used to pass the targets to config plugins
    • getTargets

      public Set<String> getTargets()
      Description copied from interface: IMixinConfig
      Get targets for this configuration
      Specified by:
      getTargets in interface IMixinConfig
      Returns:
      target classes of mixins in this config
    • getUnhandledTargets

      public Set<String> getUnhandledTargets()
      Get targets for this configuration
    • decorate

      public <V> void decorate​(String key, V value)
      Decorate this config with arbitrary metadata for debugging or compatibility purposes
      Specified by:
      decorate in interface IMixinConfig
      Type Parameters:
      V - value type
      Parameters:
      key - meta key
      value - meta value
      Throws:
      IllegalArgumentException - if the specified key exists already
    • hasDecoration

      public boolean hasDecoration​(String key)
      Get whether this node is decorated with the specified key
      Specified by:
      hasDecoration in interface IMixinConfig
      Parameters:
      key - meta key
      Returns:
      true if the specified decoration exists
    • getDecoration

      public <V> V getDecoration​(String key)
      Get the specified decoration
      Specified by:
      getDecoration in interface IMixinConfig
      Type Parameters:
      V - value type
      Parameters:
      key - meta key
      Returns:
      decoration value or null if absent
    • getLoggingLevel

      public Level getLoggingLevel()
      Get the logging level for this config
    • isVerboseLogging

      public boolean isVerboseLogging()
      Get whether verbose logging is enabled
    • packageMatch

      public boolean packageMatch​(String className)
      Get whether this config's package matches the supplied class name
      Parameters:
      className - Class name to check
      Returns:
      True if the specified class name is in this config's mixin package
    • hasMixinsFor

      public boolean hasMixinsFor​(String targetClass)
      Check whether this configuration bundle has a mixin for the specified class
      Parameters:
      targetClass - target class
      Returns:
      true if this bundle contains any mixins for the specified target
    • getMixinsFor

      public List<org.spongepowered.asm.mixin.transformer.MixinInfo> getMixinsFor​(String targetClass)
      Get mixins for the specified target class
      Parameters:
      targetClass - target class
      Returns:
      mixins for the specified target
    • reloadMixin

      public List<String> reloadMixin​(String mixinClass, org.objectweb.asm.tree.ClassNode classNode)
      Updates a mixin with new bytecode
      Parameters:
      mixinClass - Name of the mixin class
      classNode - New class
      Returns:
      List of classes that need to be updated
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo​(MixinConfig other)
      Specified by:
      compareTo in interface Comparable<MixinConfig>