Modding:Migrate to Harmony 2.0

From Stardew Valley Wiki
Revision as of 01:54, 26 January 2020 by Pathoschild (talk | contribs) (initial draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Index

This page is for modders. Players: see Modding:Mod compatibility instead.

This page explains how to update your mods for compatibility with Harmony 2.0.0. This only applies to mods which use Harmony directly; this is discouraged in most cases, isn't officially part of SMAPI's public API, and isn't subject to SMAPI's normal versioning policy.

Basic changes

  1. Change using Harmony; to using HarmonyLib;.
  2. Change HarmonyInstance harmony = HarmonyInstance.Create("your mod id"); to Harmony harmony = new Harmony("your mod id");.
  3. Recompile the mod.

That's it! If you're using the recommended code API, usage is otherwise identical. Harmony 2.0.0 adds a number of new features; see the official documentation for more info.