TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetPacket() [2/2]

ModPacket Terraria.ModLoader.Mod.GetPacket ( int capacity = 256)
inlineinherited

Creates a ModPacket object that you can write to and then send between servers and clients.

Parameters
capacityThe capacity.
Returns
Exceptions
T:System.ExceptionCannot get packet for " + Name + " because it does not exist on the other side

Definition at line 366 of file Mod.cs.

367 {
368 if (netID < 0)
369 {
370 throw new Exception("Cannot get packet for " + Name + " because it does not exist on the other side");
371 }
372 ModPacket p = new ModPacket(250, capacity + 5);
373 if (ModNet.NetModCount < 256)
374 {
375 p.Write((byte)netID);
376 }
377 else
378 {
379 p.Write(netID);
380 }
381 p.netID = netID;
382 return p;
383 }
virtual string Name
Stores the name of the mod. This name serves as the mod's identification, and also helps with saving ...
Definition Mod.cs:66

References Terraria.ModLoader.Mod.Name, Terraria.ModLoader.Mod.netID, and Terraria.ModLoader.ModNet.NetModCount.