Package org.spongepowered.asm.mixin

## Class MixinEnvironment

- java.lang.Object
- - org.spongepowered.asm.mixin.MixinEnvironment

- All Implemented Interfaces:
    `ITokenProvider`

      public final class MixinEnvironment
      extends java.lang.Object
      implements ITokenProvider

  The mixin environment manages global state information for the mixin subsystem.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `MixinEnvironment.CompatibilityLevel` | Operational compatibility level for the mixin subsystem
    `static class` | `MixinEnvironment.Feature` | Mixin features which can be specified in mixin configs as required for the config to be valid.
    `static class` | `MixinEnvironment.Option` | Mixin options
    `static class` | `MixinEnvironment.Phase` | Environment phase, deliberately not implemented as an enum
    `static class` | `MixinEnvironment.Side` | Represents a "side", client or dedicated server

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `MixinEnvironment` | `addConfiguration​(java.lang.String config)` | Deprecated. use Mixins::addConfiguration instead
    `void` | `addTransformerExclusion​(java.lang.String name)` | Deprecated. Do not use this method
    `void` | `audit()` | Invoke a mixin environment audit process
    `java.lang.Object` | `getActiveTransformer()` | Get the active mixin transformer instance (if any)
    `static MixinEnvironment.CompatibilityLevel` | `getCompatibilityLevel()` | Get the current compatibility level
    `static MixinEnvironment` | `getCurrentEnvironment()` | Gets the current environment
    `static MixinEnvironment` | `getDefaultEnvironment()` | Gets the default environment
    `static MixinEnvironment` | `getEnvironment​(MixinEnvironment.Phase phase)` | Get the mixin environment for the specified phase
    `java.util.Set<java.lang.String>` | `getErrorHandlerClasses()` | Deprecated. use Mixins::getErrorHandlerClasses
    `static MixinEnvironment.CompatibilityLevel` | `getMinCompatibilityLevel()` | Get the minimum (default) compatibility level supported by the current service
    `java.util.List<java.lang.String>` | `getMixinConfigs()` | Deprecated. no replacement
    `java.lang.String` | `getObfuscationContext()` | Get the current obfuscation context
    `boolean` | `getOption​(MixinEnvironment.Option option)` | Get the specified option from the current environment
    `<E extends java.lang.Enum<E>> E` | `getOption​(MixinEnvironment.Option option, E defaultValue)` | Get the specified option from the current environment
    `java.lang.String` | `getOptionValue​(MixinEnvironment.Option option)` | Get the specified option from the current environment
    `MixinEnvironment.Phase` | `getPhase()` | Get the phase for this environment
    `static Profiler` | `getProfiler()` | Deprecated. use Profiler.getProfiler("mixin")
    `java.lang.String` | `getRefmapObfuscationContext()` | Get the current obfuscation context
    `RemapperChain` | `getRemappers()` | Get the remapper chain for this environment
    `MixinEnvironment.Side` | `getSide()` | Get (and detect if necessary) the current side
    `java.lang.Integer` | `getToken​(java.lang.String token)` | Get a token value from this environment
    `java.util.List<ITransformer>` | `getTransformers()` | Deprecated. Do not use this method
    `java.lang.String` | `getVersion()` | Get the current mixin subsystem version
    `static void` | `init​(MixinEnvironment.Phase phase)` | Initialise the mixin environment in the specified phase
    `MixinEnvironment` | `registerTokenProvider​(IEnvironmentTokenProvider provider)` | Add a new token provider to this environment
    `MixinEnvironment` | `registerTokenProviderClass​(java.lang.String providerName)` | Add a new token provider class to this environment
    `void` | `setActiveTransformer​(IMixinTransformer transformer)` | Set the mixin transformer instance
    `static void` | `setCompatibilityLevel​(MixinEnvironment.CompatibilityLevel level)` | Deprecated. set compatibility level in configuration
    `void` | `setObfuscationContext​(java.lang.String context)` | Set the obfuscation context
    `void` | `setOption​(MixinEnvironment.Option option, boolean value)` | Set the specified option for this environment
    `MixinEnvironment` | `setSide​(MixinEnvironment.Side side)` | Allows a third party to set the side if the side is currently UNKNOWN
    `java.lang.String` | `toString()` |

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

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

- - ### Method Detail

    - #### getPhase

          public MixinEnvironment.Phase getPhase()

      Get the phase for this environment
      Returns:
        the phase

    - #### getMixinConfigs

          @Deprecated
          public java.util.List<java.lang.String> getMixinConfigs()

      Deprecated.
      no replacement
      Get mixin configurations from the blackboard
      Returns:
        list of registered mixin configs

    - #### addConfiguration

          @Deprecated
          public MixinEnvironment addConfiguration​(java.lang.String config)

      Deprecated.
      use Mixins::addConfiguration instead
      Add a mixin configuration to the blackboard
      Parameters:
        `config` - Name of configuration resource to add
      Returns:
        fluent interface

    - #### registerTokenProviderClass

          public MixinEnvironment registerTokenProviderClass​(java.lang.String providerName)

      Add a new token provider class to this environment
      Parameters:
        `providerName` - Class name of the token provider to add
      Returns:
        fluent interface

    - #### registerTokenProvider

          public MixinEnvironment registerTokenProvider​(IEnvironmentTokenProvider provider)

      Add a new token provider to this environment
      Parameters:
        `provider` - Token provider to add
      Returns:
        fluent interface

    - #### getToken

          public java.lang.Integer getToken​(java.lang.String token)

      Get a token value from this environment
      Specified by:
        `getToken` in interface `ITokenProvider`
      Parameters:
        `token` - Token to fetch
      Returns:
        token value or null if the token is not present in the environment

    - #### getErrorHandlerClasses

          @Deprecated
          public java.util.Set<java.lang.String> getErrorHandlerClasses()

      Deprecated.
      use Mixins::getErrorHandlerClasses
      Get all registered error handlers for this environment
      Returns:
        set of error handler class names

    - #### getActiveTransformer

          public java.lang.Object getActiveTransformer()

      Get the active mixin transformer instance (if any)
      Returns:
        active mixin transformer instance

    - #### setActiveTransformer

          public void setActiveTransformer​(IMixinTransformer transformer)

      Set the mixin transformer instance
      Parameters:
        `transformer` - Mixin Transformer

    - #### setSide

          public MixinEnvironment setSide​(MixinEnvironment.Side side)

      Allows a third party to set the side if the side is currently UNKNOWN
      Parameters:
        `side` - Side to set to
      Returns:
        fluent interface

    - #### getSide

          public MixinEnvironment.Side getSide()

      Get (and detect if necessary) the current side
      Returns:
        current side (or UNKNOWN if could not be determined)

    - #### getVersion

          public java.lang.String getVersion()

      Get the current mixin subsystem version
      Returns:
        current version

    - #### getOption

          public boolean getOption​(MixinEnvironment.Option option)

      Get the specified option from the current environment
      Parameters:
        `option` - Option to get
      Returns:
        Option value

    - #### setOption

          public void setOption​(MixinEnvironment.Option option,
                                boolean value)

      Set the specified option for this environment
      Parameters:
        `option` - Option to set
        `value` - New option value

    - #### getOptionValue

          public java.lang.String getOptionValue​(MixinEnvironment.Option option)

      Get the specified option from the current environment
      Parameters:
        `option` - Option to get
      Returns:
        Option value

    - #### getOption

          public <E extends java.lang.Enum<E>> E getOption​(MixinEnvironment.Option option,
                                                           E defaultValue)

      Get the specified option from the current environment
      Type Parameters:
        `E` - enum type
      Parameters:
        `option` - Option to get
        `defaultValue` - value to use if the user-defined value is invalid
      Returns:
        Option value

    - #### setObfuscationContext

          public void setObfuscationContext​(java.lang.String context)

      Set the obfuscation context
      Parameters:
        `context` - new context

    - #### getObfuscationContext

          public java.lang.String getObfuscationContext()

      Get the current obfuscation context

    - #### getRefmapObfuscationContext

          public java.lang.String getRefmapObfuscationContext()

      Get the current obfuscation context

    - #### getRemappers

          public RemapperChain getRemappers()

      Get the remapper chain for this environment

    - #### audit

          public void audit()

      Invoke a mixin environment audit process

    - #### getTransformers

          @Deprecated
          public java.util.List<ITransformer> getTransformers()

      Deprecated.
      Do not use this method
      Returns (and generates if necessary) the transformer delegation list for this environment.
      Returns:
        current transformer delegation list (read-only)

    - #### addTransformerExclusion

          @Deprecated
          public void addTransformerExclusion​(java.lang.String name)

      Deprecated.
      Do not use this method
      Adds a transformer to the transformer exclusions list
      Parameters:
        `name` - Class transformer exclusion to add

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### init

          public static void init​(MixinEnvironment.Phase phase)

      Initialise the mixin environment in the specified phase
      Parameters:
        `phase` - initial phase

    - #### getEnvironment

          public static MixinEnvironment getEnvironment​(MixinEnvironment.Phase phase)

      Get the mixin environment for the specified phase
      Parameters:
        `phase` - phase to fetch environment for
      Returns:
        the environment

    - #### getDefaultEnvironment

          public static MixinEnvironment getDefaultEnvironment()

      Gets the default environment
      Returns:
        the `DEFAULT` environment

    - #### getCurrentEnvironment

          public static MixinEnvironment getCurrentEnvironment()

      Gets the current environment
      Returns:
        the currently active environment

    - #### getCompatibilityLevel

          public static MixinEnvironment.CompatibilityLevel getCompatibilityLevel()

      Get the current compatibility level

    - #### getMinCompatibilityLevel

          public static MixinEnvironment.CompatibilityLevel getMinCompatibilityLevel()

      Get the minimum (default) compatibility level supported by the current service

    - #### setCompatibilityLevel

          @Deprecated
          public static void setCompatibilityLevel​(MixinEnvironment.CompatibilityLevel level)
                                            throws java.lang.IllegalArgumentException

      Deprecated.
      set compatibility level in configuration
      Set desired compatibility level for the entire environment
      Parameters:
        `level` - Level to set, ignored if less than the current level
      Throws:
        `java.lang.IllegalArgumentException` - if the specified level is not supported

    - #### getProfiler

          @Deprecated
          public static Profiler getProfiler()

      Deprecated.
      use Profiler.getProfiler("mixin")
      Get the performance profiler
      Returns:
        profiler