Created
March 4, 2021 03:41
-
-
Save TheGlitch76/1337f005d486cf122d0a10b955e990ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class Helper { | |
public static void shim(Minecraft minecraft, Bar someArg) { | |
// do stuff | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mixin(Minecraft.class) | |
public abstract class MixinMinecraft implements Shim { | |
@Override | |
public void implementedByMixin {/**/} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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