3using Terraria.Localization;
17 internal short netID = -1;
19 internal ModPacket(
byte messageID,
int capacity = 256) : base(new MemoryStream(capacity)) {
27 public void Send(
int toClient = -1,
int ignoreClient = -1) {
30 if (Main.netMode == 1) {
39 else if (toClient != -1)
42 for (
int i = 0; i < 256; i++)
43 if (i != ignoreClient && Netplay.Clients[i].IsConnected() && NetMessage.buffer[i].broadcast)
53 if (OutStream.Position > ushort.MaxValue)
54 throw new Exception(Language.GetTextValue(
"tModLoader.MPPacketTooLarge", OutStream.Position, ushort.MaxValue));
56 len = (ushort)OutStream.Position;
57 Seek(0, SeekOrigin.Begin);
60 buf = ((MemoryStream)OutStream).GetBuffer();
This class inherits from BinaryWriter. This means that you can use all of its writing functions to se...
void Send(int toClient=-1, int ignoreClient=-1)
Sends all the information you've written between client and server. If the toClient parameter is non-...
void SendCallback(object state)