com.llamalad7.mixinextras.injector.ModifyExpressionValue 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 tweak the resultant value of a
* {@link org.spongepowered.asm.mixin.injection.points.BeforeInvoke method call},
* {@link org.spongepowered.asm.mixin.injection.points.BeforeFieldAccess field get},
* {@link org.spongepowered.asm.mixin.injection.points.BeforeConstant constant} or
* {@link org.spongepowered.asm.mixin.injection.points.BeforeNew object instantiation}.
*
* Your handler method receives the expression's resultant value (optionally followed by the enclosing method's
* parameters), and should return the adjusted value:
*
* {@code private (static) ExpressionType handler(ExpressionType original)}
*
* This chains when used by multiple people, unlike
* {@link org.spongepowered.asm.mixin.injection.Redirect @Redirect} and
* {@link org.spongepowered.asm.mixin.injection.ModifyConstant @ModifyConstant}.
*
* 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 ModifyExpressionValue {
String[] method();
At[] at();
Slice[] slice() default {};
boolean remap() default true;
int require() default -1;
int expect() default 1;
int allow() default -1;
}