-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDowsingMod.cs
More file actions
68 lines (52 loc) · 1.65 KB
/
Copy pathDowsingMod.cs
File metadata and controls
68 lines (52 loc) · 1.65 KB
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
60
61
62
63
64
65
66
67
68
using HamstarHelpers.Components.Config;
using HamstarHelpers.Helpers.DebugHelpers;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Dowsing {
class DowsingMod : Mod {
public JsonConfig<ConfigurationData> Config { get; private set; }
public int DEBUGFLAGS { get; private set; } // +1: info, +2: reset dowsings
////////////////
public DowsingMod() {
this.Properties = new ModProperties() {
Autoload = true,
AutoloadGores = true,
AutoloadSounds = true
};
this.DEBUGFLAGS = 0;
string filename = "Dowsing Config.json";
this.Config = new JsonConfig<ConfigurationData>( filename, "Mod Configs", new ConfigurationData() );
}
public override void Load() {
this.LoadConfig();
}
private void LoadConfig() {
try {
if( !this.Config.LoadFile() ) {
this.Config.SaveFile();
}
} catch( Exception e ) {
LogHelpers.Log( e.Message );
this.Config.SaveFile();
}
if( this.Config.Data.UpdateToLatestVersion() ) {
ErrorLogger.Log( "Dowsing mod updated to " + ConfigurationData.CurrentVersion.ToString() );
this.Config.SaveFile();
}
this.DEBUGFLAGS = this.Config.Data.DEBUGFLAGS;
}
////////////////
public override void HandlePacket( BinaryReader reader, int whoAmI ) {
DowsingNetProtocol.RoutePacket( this, reader );
}
////////////////
public override void AddRecipeGroups() {
if( !this.Config.Data.Enabled ) { return; }
RecipeGroup group = new RecipeGroup( () => Lang.misc[37] + " Evil Biome Wood", new int[] { ItemID.Ebonwood, ItemID.Shadewood } );
RecipeGroup.RegisterGroup( "Dowsing:EvilBiomeWood", group );
}
}
}