Harmony: changing what the game does
Sometimes your mod needs the game to do something different, not just add things. Harmony is for that: it is like sticking a note on one of the game’s functions that says “before (or after) you run, run this”. The game is not modified; the change lives only in your mod.
var harmony = new Harmony("my_mod");Four rules
- Apply your patches from
IClientModInitializer(first frame), not earlier. - Use one Harmony instance per mod, named with your mod id.
- If the player turns your mod off, remove your patches cleanly.
- Do not patch the same function from two copies of your mod. Aether loads a single copy per id.
Harmony is an advanced tool. If this is your first mod, leave it for the second.