-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModSystem.cs
More file actions
37 lines (31 loc) · 886 Bytes
/
ModSystem.cs
File metadata and controls
37 lines (31 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using HarmonyLib;
using Vintagestory.API.Client;
using Vintagestory.API.Common;
namespace QuickCraft;
public sealed class QuickCraftModSystem : ModSystem
{
private Harmony? harmony;
public override bool ShouldLoad(EnumAppSide side)
{
return side == EnumAppSide.Client;
}
public override void StartClientSide(ICoreClientAPI api)
{
RecipeVariantCollector.ClearCache();
HandbookSpaceCrafting.SetApi(api);
harmony = new Harmony(ModIds.HarmonyId);
harmony.PatchAll();
}
public override void Dispose()
{
harmony?.UnpatchAll(ModIds.HarmonyId);
harmony = null;
RecipeVariantCollector.ClearCache();
HandbookSpaceCrafting.SetApi(null);
}
}
internal static class ModIds
{
public const string ModId = "quickcraft";
public const string HarmonyId = ModId + ".spacecraft";
}