2 using System.Collections.Generic;
11 internal static class ModifierPoolIO
13 public const int SAVE_VERSION = 14;
17 string type = reader.ReadString();
18 string modName = reader.ReadString();
23 throw new Exception($
"Modifier _NetReceive error for {modName}");
26 int activeModifiersSize = reader.ReadInt32();
27 var list =
new List<Modifier>();
28 for (
int i = 0; i < activeModifiersSize; ++i)
30 list.Add(ModifierIO.NetReceive(item, reader));
34 finitePool.NetReceive(item, reader);
40 writer.Write(pool.
Name);
41 writer.Write(pool.
Mod.Name);
46 ModifierIO.NetSend(modifier, item, writer);
54 if (tag == null || tag.ContainsKey(
"EMMErr:PoolNullErr"))
59 var saveVersion = tag.ContainsKey(
"SaveVersion") ? tag.GetInt(
"SaveVersion") : 1;
66 var list =
new List<Modifier>();
67 int count = tag.GetAsInt(
"Count");
68 for (
int i = 0; i < count; ++i)
70 var loaded = ModifierIO.
Load(item, tag.Get<TagCompound>($
"Modifier{i}"));
84 return new TagCompound { {
"EMMErr:PoolNullErr",
"ModifierPool was null err" } };
87 var tag =
new TagCompound
89 {
"SaveVersion", SAVE_VERSION},
93 for (
int i = 0; i < pool.
Modifiers.Count; ++i)
95 tag.Add($
"Modifier{i}", ModifierIO.Save(item, pool.
Modifiers[i]));
Defines a "Null" modifier which represents a pool with no modifiers Cannot be rolled normally ...
static NullModifierPool INSTANCE
virtual void NetSend(Item item, BinaryWriter writer)
Allows modder to do custom NetSend here
virtual void Save(Item item, TagCompound tag)
Allows modder to do custom saving here Use the given TC to put data you want to save, which can be loaded using Load(Item, TagCompound)
static ModifierPoolContent ModifierPool
virtual void Load(Item item, TagCompound tag)
Allows modder to do custom loading here Use the given TC to pull data you saved using Save(Item...
Defines a modifier pool. A modifier pool holds a certain amount of effects in an array It allows to r...
readonly List< Modifier > Modifiers
This class holds all Content holders of this mod You can use this to access content loaded into the m...