ModifyVariable¶
ModifyVariable provides a simple way to modify a variable (crazy).
Say we had the following class
If we wanted to modify the value provided to original, we could do so
@ModifyVariable(method = "target", at = @At("STORE"))
private double changeVariable(double original) { // method type is double, same as the variable type
return original * 3.0;
}
And this becomes
To specify which variable to modify, you will need to use ordinals/indices, at least until we are on deobfuscated Minecraft versions.