-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
OverhaulMod.cs
59 lines (47 loc) · 1.81 KB
/
OverhaulMod.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
59
using System;
using System.IO;
using System.Reflection;
using Microsoft.Xna.Framework;
using ReLogic.Content.Sources;
using Terraria;
using Terraria.ModLoader;
using TerrariaOverhaul.Core.Networking;
using TerrariaOverhaul.Core.VideoPlayback;
namespace TerrariaOverhaul;
public class OverhaulMod : Mod
{
public static readonly uint BetaNumber = 14;
public static readonly bool IsBeta = BetaNumber > 0;
public static readonly string VersionSuffix = $"(BETA {BetaNumber})";
public static readonly string PersonalDirectory = Path.Combine(Main.SavePath, "TerrariaOverhaul");
public static readonly Version MinimalTMLVersion = new("0.12");
public static readonly Assembly Assembly;
public static readonly Assembly EngineAssembly;
public static readonly Assembly TMLAssembly;
private static OverhaulMod? instance;
//internal static readonly ResourceManager ResourceManager = new ResourceManager("TerrariaOverhaul.Properties.Resources", Assembly.GetExecutingAssembly());
public static OverhaulMod Instance => instance ?? throw new InvalidOperationException("An instance of the mod has not yet been created.");
static OverhaulMod()
{
Assembly = Assembly.GetExecutingAssembly();
EngineAssembly = typeof(Game).Assembly;
TMLAssembly = typeof(ModLoader).Assembly;
}
public OverhaulMod()
{
instance = this;
Directory.CreateDirectory(PersonalDirectory);
/*if(ModLoader.version < MinimalTMLVersion) {
throw new OutdatedTModLoaderException(MinimalTMLVersion);
}*/
}
public override IContentSource CreateDefaultContentSource()
{
if (!Main.dedServ) {
AddContent(new OgvReader()); // This manual ILoadable adds readers to AssetReaderCollections.
}
return base.CreateDefaultContentSource();
}
public override void HandlePacket(BinaryReader reader, int sender)
=> MultiplayerSystem.HandlePacket(reader, sender);
}