frogmc.dev/exts/mixin.md

17 lines
1.3 KiB
Markdown
Raw Normal View History

# Mixin
2024-06-10 23:29:56 -04:00
[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-->