/
ZEROWORLD.cs
58 lines (49 loc) · 1.28 KB
/
ZEROWORLD.cs
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Reflection;
using Terraria;
using Terraria.ModLoader;
using Terraria.Utilities;
using ZEROWORLD.Files;
using ZEROWORLD.Items;
namespace ZEROWORLD
{
public class ZEROWORLD : Mod
{
public static bool DeveloperMode
{
get;
} = true;
public static UnifiedRandom SafeRandom => Main.rand ?? (Main.rand = new UnifiedRandom(20201027));
internal static Assembly Assembly
{
get;
} = Assembly.GetExecutingAssembly();
internal static ZEROWORLD Instance
{
get;
private set;
}
public ZEROWORLD()
{
Instance = this;
ZAction.Initialize();
}
public override void Load() => ZAction.LoadAction.TryAction(ThrowError);
public override void Unload()
{
ZAction.UnloadAction.TryAction(ThrowError);
GC.Collect();
}
internal static void ThrowError(Exception exception)
{
string writeText = $"Message: {exception.Message}\nStackTrace: {exception.StackTrace}";
ZDeveloperSetting.Write(ZDeveloperSetting.MessageType.Error, "{0}", writeText);
throw new Exception(writeText);
}
#region 引用其他类的方法
public override void AddRecipeGroups() => ZRecipes.RecipeGroups();
public override void AddRecipes() => ZRecipes.Recipes();
public override object Call(params object[] args) => ZCall.Call(args);
#endregion
}
}