add exts/mixin.md

This commit is contained in:
lilly 2024-06-10 22:29:56 -05:00
parent 5f5271e459
commit a5b5fc0dbe
Signed by: MaeMachineBroke
GPG key ID: B54591A4805E9CC8

View file

@ -1,2 +1,16 @@
# Mixin
[Mixin](https://github.com/SpongePowered/Mixin) is an ASM framework to modify the code of the game created by the SpongePowered project. Mixin is widely supported by many modloaders, and frog is no exception, offering support for using Mixin in mods. This document is not intended as a comprehensive tutorial on the specifics of Mixin, but it is designed to give a basic understanding of its principles as well as how to use it in a frog mod.
## Adding Mixins
A Mixin is a specially-annotated class that goes in a package within your mod. Mixins, by default, are common to both the server and client; however, it is possible to write a server or client-specific mixin. By convention, this package is called `mixin` and is in the root package of your mod. Additionally, a metadata file with the extension `.mixins.json` is included in your `resources` folder to tell the Mixin system where your mixins are located. The details of how to format that file are contained in [this specification](/spec/mixin-config). The final piece of setup before you can start using Mixin is to add this configuration file to the `[frog.extensions]` table in your `frog.mod.toml` as follows:
```toml
[frog.extensions]
...
mixin = "<modid>.mixins.json"
...
```
Replace `<modid>` with your mod's namespace id, and you're ready to write mixins!
<!--- TODO: Tutorial for mixin usage-->