Package org.spongepowered.asm.mixin
Class MixinEnvironment
java.lang.Object
org.spongepowered.asm.mixin.MixinEnvironment
- All Implemented Interfaces:
ITokenProvider
The mixin environment manages global state information for the mixin
subsystem.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumOperational compatibility level for the mixin subsystemstatic enumMixin features which can be specified in mixin configs as required for the config to be valid.static enumMixin optionsstatic final classEnvironment phase, deliberately not implemented as an enumstatic enumRepresents a "side", client or dedicated server -
Method Summary
Modifier and TypeMethodDescriptionaddConfiguration(String config) Deprecated.use Mixins::addConfiguration insteadvoidDeprecated.Do not use this methodvoidaudit()Invoke a mixin environment audit processGet the active mixin transformer instance (if any)Get the current compatibility levelstatic MixinEnvironmentGets the current environmentstatic MixinEnvironmentGets the default environmentstatic MixinEnvironmentGet the mixin environment for the specified phaseDeprecated.use Mixins::getErrorHandlerClassesGet the minimum (default) compatibility level supported by the current serviceDeprecated.no replacementGet the current obfuscation contextbooleangetOption(MixinEnvironment.Option option) Get the specified option from the current environment<E extends Enum<E>>
EgetOption(MixinEnvironment.Option option, E defaultValue) Get the specified option from the current environmentGet the specified option from the current environmentgetPhase()Get the phase for this environmentstatic ProfilerDeprecated.use Profiler.getProfiler("mixin")Get the current obfuscation contextGet the remapper chain for this environmentgetSide()Get (and detect if necessary) the current sideGet a token value from this environmentDeprecated.Do not use this methodGet the current mixin subsystem versionstatic voidinit(MixinEnvironment.Phase phase) Initialise the mixin environment in the specified phaseAdd a new token provider to this environmentregisterTokenProviderClass(String providerName) Add a new token provider class to this environmentvoidsetActiveTransformer(IMixinTransformer transformer) Set the mixin transformer instancestatic voidDeprecated.set compatibility level in configurationvoidsetObfuscationContext(String context) Set the obfuscation contextvoidsetOption(MixinEnvironment.Option option, boolean value) Set the specified option for this environmentsetSide(MixinEnvironment.Side side) Allows a third party to set the side if the side is currently UNKNOWNtoString()
-
Method Details
-
getPhase
Get the phase for this environment- Returns:
- the phase
-
getMixinConfigs
Deprecated.no replacementGet mixin configurations from the blackboard- Returns:
- list of registered mixin configs
-
addConfiguration
Deprecated.use Mixins::addConfiguration insteadAdd a mixin configuration to the blackboard- Parameters:
config- Name of configuration resource to add- Returns:
- fluent interface
-
registerTokenProviderClass
Add a new token provider class to this environment- Parameters:
providerName- Class name of the token provider to add- Returns:
- fluent interface
-
registerTokenProvider
Add a new token provider to this environment- Parameters:
provider- Token provider to add- Returns:
- fluent interface
-
getToken
Get a token value from this environment- Specified by:
getTokenin interfaceITokenProvider- Parameters:
token- Token to fetch- Returns:
- token value or null if the token is not present in the environment
-
getErrorHandlerClasses
Deprecated.use Mixins::getErrorHandlerClassesGet all registered error handlers for this environment- Returns:
- set of error handler class names
-
getActiveTransformer
Get the active mixin transformer instance (if any)- Returns:
- active mixin transformer instance
-
setActiveTransformer
Set the mixin transformer instance- Parameters:
transformer- Mixin Transformer
-
setSide
Allows a third party to set the side if the side is currently UNKNOWN- Parameters:
side- Side to set to- Returns:
- fluent interface
-
getSide
Get (and detect if necessary) the current side- Returns:
- current side (or UNKNOWN if could not be determined)
-
getVersion
Get the current mixin subsystem version- Returns:
- current version
-
getOption
Get the specified option from the current environment- Parameters:
option- Option to get- Returns:
- Option value
-
setOption
Set the specified option for this environment- Parameters:
option- Option to setvalue- New option value
-
getOptionValue
Get the specified option from the current environment- Parameters:
option- Option to get- Returns:
- Option value
-
getOption
Get the specified option from the current environment- Type Parameters:
E- enum type- Parameters:
option- Option to getdefaultValue- value to use if the user-defined value is invalid- Returns:
- Option value
-
setObfuscationContext
Set the obfuscation context- Parameters:
context- new context
-
getObfuscationContext
Get the current obfuscation context -
getRefmapObfuscationContext
Get the current obfuscation context -
getRemappers
Get the remapper chain for this environment -
audit
public void audit()Invoke a mixin environment audit process -
getTransformers
Deprecated.Do not use this methodReturns (and generates if necessary) the transformer delegation list for this environment.- Returns:
- current transformer delegation list (read-only)
-
addTransformerExclusion
Deprecated.Do not use this methodAdds a transformer to the transformer exclusions list- Parameters:
name- Class transformer exclusion to add
-
toString
-
init
Initialise the mixin environment in the specified phase- Parameters:
phase- initial phase
-
getEnvironment
Get the mixin environment for the specified phase- Parameters:
phase- phase to fetch environment for- Returns:
- the environment
-
getDefaultEnvironment
Gets the default environment- Returns:
- the
DEFAULTenvironment
-
getCurrentEnvironment
Gets the current environment- Returns:
- the currently active environment
-
getCompatibilityLevel
Get the current compatibility level -
getMinCompatibilityLevel
Get the minimum (default) compatibility level supported by the current service -
setCompatibilityLevel
@Deprecated public static void setCompatibilityLevel(MixinEnvironment.CompatibilityLevel level) throws IllegalArgumentException Deprecated.set compatibility level in configurationSet desired compatibility level for the entire environment- Parameters:
level- Level to set, ignored if less than the current level- Throws:
IllegalArgumentException- if the specified level is not supported
-
getProfiler
Deprecated.use Profiler.getProfiler("mixin")Get the performance profiler- Returns:
- profiler
-