Skip to content

Instantly share code, notes, and snippets.

@TheGlitch76
Created March 4, 2021 03:41
Show Gist options
  • Save TheGlitch76/1337f005d486cf122d0a10b955e990ab to your computer and use it in GitHub Desktop.
Save TheGlitch76/1337f005d486cf122d0a10b955e990ab to your computer and use it in GitHub Desktop.
public interface Duck {
@AutoImplement(Helper.class) // allowed at class or method level
void shim(Bar someArg);
@ManualImplement // to opt out in the case of class-level annotation, assumed by default otherwise
void implementedByMixin();
}
public final class Helper {
public static void shim(Minecraft minecraft, Bar someArg) {
// do stuff
}
}
public class Minecraft implements Duck{
@Override
public void shim(Bar someArg) {
// filled in automatically
Helper.shim(this, someArg);
}
// native for effect, probably wouldn't do it this way
@Override
public native void implementedByMixin();
}
@Mixin(Minecraft.class)
public abstract class MixinMinecraft implements Shim {
@Override
public void implementedByMixin {/**/}
}
magic/v1
[internal|exports] com/example/Duck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment