Mods/SpongePowered Mixin/@Inject
From Wildermyth Wiki
< Mods | SpongePowered Mixin
Modded Content: This content is part of the Mixin coremod
Annotation @Mixin
| Fully Qualified Name | org.spongepowered.asm.mixin.injection.Inject
|
@Target |
METHOD |
@Retention |
RUNTIME |
@Inject declares that a method is an injection callback method. This means that the code defined in this method should be injected into the some target method. This allows coremods to change the game's logic without editing the source code directly.
| Modifier and Type | Element Name | Description |
|---|---|---|
@At[][1] |
at | Array of @At annotations which describe the Injection Points in the target method.
|
| Modifier and Type | Element Name | Default | Description |
|---|---|---|---|
int |
allow | -1 |
Injection points by default are expected to match every candidate instruction in the target method or slice, except in cases where such options such as @At.ordinal() are specified which by definition limit the number of results. This option limits the maximum number of matches for this injector. Setting any value 1 or greater is allowed. Values less than 1 or less than require() are ignored.
|
boolean |
cancellable | false |
Allows this injection callback to be cancellable, meaning it can inject RETURN opcodes into the target method. Return behavior can then be controlled from within the callback by interacting with the CallbackInfo object. |
String[2] |
constraints | "" |
The constraints[3] which must be validated for this injector to succeed. |
int |
expect | 1 |
Like require, but only enabled if mixin.debug.countInjections is set to true. Unlike require(), defaults to 1.
|
String[4] |
id | "" |
The identifier for this injector. Can be retrieved by calling CallbackInfo.getId().
|
LocalCapture[5] |
locals | {} |
Deprecated. Specifies the local variable capture variable behavior for this injector. Use @Local instead. |
String[][6] |
method | {} |
String representation of one or more Target Selectors which identify the target methods. |
int |
order | 1000 |
By default almost all injectors for a target class apply their injections at the same time. If multiple mixins target the same class, then the injectors are applied in priority order. The default order for injectors is 1000.
Specifying a value for |
boolean |
remap | true |
Used for obfuscation. Since Wildermyth is not obfuscated, you never need to worry about this. |
int |
require | -1 |
Generally, injectors are intended to fail softly. However this is not always desirable. This parameter allows you to stipulate a minimum amount of successful injections for this callback handler. If the number of injections specified is not achieved, then an InjectionError is thrown at classload time.
|
Slice[] [7] |
slice | {} |
Array of @Slice annotations which describe the method bisections used in the at() queries for this injector.
|
Desc[] [8] |
target | {} |
Literal representation of one or more @Desc annotations which identify the target methods |