/// <summary> /// Patches changeSkinColor using a harmony transpiler. /// </summary> private void PatchSkinColor() { SkinColorPatch skinColorPatch = new SkinColorPatch(Entry); Entry.Monitor.Log("Patching changeSkinColor()", LogLevel.Trace); Harmony.Patch( original: AccessTools.Method(typeof(Farmer), nameof(Farmer.changeSkinColor)), transpiler: new HarmonyMethod(skinColorPatch.GetType(), nameof(SkinColorPatch.ChangeSkinColorTranspiler)) ); }
/// <summary>Harmony patch to patch the accessory length and skin color length</summary> private void CommenceHarmonyPatch() { //Create a new instance of the patches AccessoryPatch accessoryPatch = new AccessoryPatch(this); SkinColorPatch skinColorPatch = new SkinColorPatch(this); //Tell the log I'm patching it, then patch it. Monitor.Log("Patching changeAccessory()", LogLevel.Trace); Harmony.Patch( original: AccessTools.Method(typeof(Farmer), nameof(Farmer.changeAccessory)), transpiler: new HarmonyMethod(accessoryPatch.GetType(), nameof(AccessoryPatch.ChangeAccessoryTranspiler)) ); //Patch the skin color length Monitor.Log("Patching changeSkinColor()", LogLevel.Trace); Harmony.Patch( original: AccessTools.Method(typeof(Farmer), nameof(Farmer.changeSkinColor)), transpiler: new HarmonyMethod(skinColorPatch.GetType(), nameof(SkinColorPatch.ChangeSkinColorTranspiler)) ); }