Skip to content

Commit 90491b8

Browse files
author
hamstar0
committed
v2.1.7.5
* Added error prevention measures with references to local player
1 parent 5545705 commit 90491b8

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

NetProtocol/FiltersProtocol.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using HamstarHelpers.Components.Errors;
22
using HamstarHelpers.Components.Network;
3+
using HamstarHelpers.Helpers.TmlHelpers;
34
using Nihilism.Data;
45
using Terraria;
56

@@ -50,7 +51,7 @@ protected override void ReceiveOnClient() {
5051

5152
var mymod = NihilismMod.Instance;
5253
var myworld = mymod.GetModWorld<NihilismWorld>();
53-
var myplayer = Main.LocalPlayer.GetModPlayer<NihilismPlayer>();
54+
var myplayer = (NihilismPlayer)TmlHelpers.SafelyGetModPlayer( Main.LocalPlayer, mymod, "NihilismPlayer" );
5455

5556
myworld.Logic.PostFiltersLoad();
5657

NetProtocol/ModSettingsProtocol.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using HamstarHelpers.Components.Network;
2+
using HamstarHelpers.Helpers.TmlHelpers;
23
using Nihilism.Data;
34
using Terraria;
45

@@ -20,7 +21,7 @@ protected override void InitializeServerSendData( int toWho ) {
2021

2122
protected override void ReceiveReply() {
2223
var mymod = NihilismMod.Instance;
23-
var myplayer = Main.LocalPlayer.GetModPlayer<NihilismPlayer>();
24+
var myplayer = (NihilismPlayer)TmlHelpers.SafelyGetModPlayer( Main.LocalPlayer, mymod, "NihilismPlayer" );
2425

2526
mymod.ConfigJson.SetData( this.Settings );
2627

NihilismWorld.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using HamstarHelpers.Helpers.DebugHelpers;
22
using Nihilism.Logic;
3+
using Terraria;
34
using Terraria.ModLoader;
45
using Terraria.ModLoader.IO;
56

@@ -22,13 +23,17 @@ public override void Initialize() {
2223
}
2324

2425
public override void Load( TagCompound tag ) {
25-
this.Logic.LoadWorldData();
26+
if( Main.netMode != 1 ) {
27+
this.Logic.LoadWorldData();
28+
}
2629
}
2730

2831
public override TagCompound Save() {
29-
var mymod = (NihilismMod)this.mod;
30-
if( !mymod.SuppressAutoSaving ) {
31-
this.Logic.SaveWorldData();
32+
if( Main.netMode != 1 ) {
33+
var mymod = (NihilismMod)this.mod;
34+
if( !mymod.SuppressAutoSaving ) {
35+
this.Logic.SaveWorldData();
36+
}
3237
}
3338
return new TagCompound();
3439
}

build.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
author = hamstar
2-
version = 2.1.7.3
2+
version = 2.1.7.5
33
displayName = Nihilism
4-
modReferences = HamstarHelpers@4.2.3.1
4+
modReferences = HamstarHelpers@4.2.4
55
buildIgnore = *.csproj, *.user, *.bat, obj\*, bin\*, .vs\*, .git\*
66
languageVersion = 6
77
homepage = https://forums.terraria.org/index.php?threads/nihilism-empties-the-game.60333/

0 commit comments

Comments
 (0)