public override void SetupStartInventory(IList <Item> items, bool mediumcoreDeath) // Runs on player creation, so that mods are serialized even if you don't enter the world. { if (ModState.PrevLoadedPlayerMods.ContainsKey(player.name)) { ModState.PrevLoadedPlayerMods.Remove(player.name); } ModState.PrevLoadedPlayerMods.Add(player.name, new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousPlayerMods(); }
public override void OnEnterWorld(Player player) { if (ModState.PrevLoadedPlayerMods.ContainsKey(player.name)) { ModState.PrevLoadedPlayerMods.Remove(player.name); } ModState.PrevLoadedPlayerMods.Add(player.name, new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousPlayerMods(); if (ModState.PrevLoadedWorldMods.ContainsKey($"{Main.worldID}:{Main.worldName}")) { ModState.PrevLoadedWorldMods.Remove($"{Main.worldID}:{Main.worldName}"); } ModState.PrevLoadedWorldMods.Add($"{Main.worldID}:{Main.worldName}", new PrevMods { PrevEnabledMods = new HashSet <string>(ModState.EnabledMods) }); ModState.SerializePreviousWorldMods(); }