Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 763 Bytes

shadow.md

File metadata and controls

37 lines (30 loc) · 763 Bytes

@Shadow

<- Return

Allows accessing a field or method from the the target class only inside the mixin class.

Example mixin:

@Mixin(Dummy.class)
public abstract class MixinDummy {
	@Shadow
	private int dummyField;

	@Shadow
	public abstract void dummyMethod();
}

Usage:

  public void myInjector(CallbackInfo info) {
      this.dummyField = newValue;
      this.dummyMethod();
  }

To access fields or methods from the target class' superclass, extend it or implement it. Keeping the class abstract allows you to skip implementing methods. Example mixin:

@Mixin(Dummy.class)
public abstract class MixinDummy extends SuperDummy {
  public void myInjector(CallbackInfo info) {
    this.superMethod();
  }
}