public override void SyncPlayer(int toWho, int fromWho, bool newPlayer) { ModPacket packet = mod.GetPacket(); int cnt = 0; TagCompound research2 = new TagCompound(); IEnumerator <KeyValuePair <string, object> > enume = research.GetEnumerator(); enume.Reset(); while (enume.MoveNext()) { research2[enume.Current.Key] = research.GetAsInt(enume.Current.Key); cnt += (enume.Current.Key.ToByteArray().Length / 128) + 1; if (cnt >= 500) { packet.Write((byte)0); packet.Write((byte)player.whoAmI); TagIO.Write(research2, packet); packet.Send(toWho, fromWho); cnt = 0; packet = mod.GetPacket(); research2.Clear(); } } if (cnt > 0) { packet.Write((byte)0); packet.Write((byte)player.whoAmI); TagIO.Write(research2, packet); packet.Send(toWho, fromWho); } packet = mod.GetPacket(); packet.Write((byte)1); packet.Write((byte)player.whoAmI); packet.Send(toWho, fromWho); }