i dont rememebr

This commit is contained in:
NotAKidoS 2024-01-01 11:58:25 -06:00
parent 374ab6c11e
commit 86828a94e2
48 changed files with 1637 additions and 841 deletions

View file

@ -0,0 +1,45 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Util.AssetFiltering;
using HarmonyLib;
using MelonLoader;
using UnityEngine;
namespace NAK.LateInitComponentHelperHack;
public class LateInitComponentHelperHack : MelonMod
{
private static bool _hasLoggedIn;
public override void OnInitializeMelon()
{
ApplyPatches(typeof(HarmonyPatches));
}
private void ApplyPatches(Type type)
{
try
{
HarmonyInstance.PatchAll(type);
}
catch (Exception e)
{
LoggerInstance.Msg($"Failed while patching {type.Name}!");
LoggerInstance.Error(e);
}
}
private static class HarmonyPatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ComponentHelper), nameof(ComponentHelper.Initialize))]
private static bool Prefix_ComponentHelper_Initialize() => _hasLoggedIn;
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
private static void Postfix_PlayerSetup_Start()
{
_hasLoggedIn = true;
ComponentHelper.Initialize();
}
}
}