Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 556 Bytes

modify-args.md

File metadata and controls

33 lines (26 loc) · 556 Bytes

@ModifyArgs

<- Return

Changes all arguments in a method invocation.

Parameters:

  • Args

Return type: void

Example mixin:

@ModifyArgs(
    method = "target",
    at = @At(value = "INVOKE", target = "Lnet/example/Dummy;dummy(IIII)V")
)
private void mixin(Args args) {
    args.set(0, args.get(0) - 1);
    args.set(1, 1);
    args.set(2, 0);
    args.set(3, 1);
}

Method modification:

  public void target() {
+     Dummy.getInstance().dummy(0, 1, 0, 1);
-     Dummy.getInstance().dummy(1, 2, 3, 4);
  }