com.llamalad7.mixinextras.injector.ModifyReceiver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mixinextras-fabric Show documentation
Show all versions of mixinextras-fabric Show documentation
Companion library to Mixin with lots of features to improve the compatibility and concision of your mixins!
package com.llamalad7.mixinextras.injector;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Slice;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Allows you to modify the receiver of a non-static
* {@link org.spongepowered.asm.mixin.injection.points.BeforeInvoke method call} or
* {@link org.spongepowered.asm.mixin.injection.points.BeforeFieldAccess field get/set}.
*
* Your handler method receives the targeted instruction's arguments (optionally followed by the enclosing method's
* parameters), and should return the adjusted receiver for the operation.
*
*
* Targeted operation
* Handler signature
*
*
* Non-static method call
* private (static) ReceiverType handler(ReceiverType original, <params of the
* original call>)
*
*
* super.
method call
* private (static) ThisClass handler(ThisClass original, <params of the original
* call>)
*
*
* Non-static field get
* private (static) ReceiverType handler(ReceiverType original)
*
*
* Non-static field write
* private (static) ReceiverType handler(ReceiverType original, FieldType newValue)
*
*
*
* This chains when used by multiple people, unlike
* {@link org.spongepowered.asm.mixin.injection.Redirect @Redirect}.
*
* If you never use the {@code original} then you risk other people's changes being silently ignored.
*
* See the wiki article for more info.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface ModifyReceiver {
String[] method();
At[] at();
Slice[] slice() default {};
boolean remap() default true;
int require() default -1;
int expect() default 1;
int allow() default -1;
}