tModLoader v2025.07
A mod to make and play Terraria mods
Netplay Class Reference

Static Public Member Functions

static void AddBan (int plr)
 
static void AddCurrentServerToRecentList ()
 
static int GetSectionX (int x)
 
static int GetSectionY (int y)
 
static void Initialize ()
 
static void InvalidateAllOngoingIPSetAttempts ()
 
static bool IsBanned (RemoteAddress address)
 
static void OnConnectedToSocialServer (ISocket client)
 
static void ResetSections ()
 Sets all world sections as unloaded for all clients. This results in all clients being sent the world sections again.

This is used at the end of Hardmode world generation to force all clients to receive the tiles from the server again.

If you are doing massive world changes in-game outside of the Hardmode transformation, this is a simple way to ensure that all clients see those tile changes without sending countless NetMessage.SendTileSquare(int, int, int, TileChangeType) messages.

Call on Server only!
 
static bool SetRemoteIP (string remoteAddress)
 
static void SetRemoteIPAsync (string remoteAddress, Action successCallBack)
 
static bool SetRemoteIPOld (string remoteAddress)
 
static void SocialClientLoop (object threadContext)
 
static void StartBroadCasting ()
 
static void StartServer ()
 
static void StartSocialClient (ISocket socket)
 
static void StartTcpClient ()
 
static void StopBroadCasting ()
 
static void TcpClientLoop ()
 
static void UpdateInMainThread ()
 

Static Public Attributes

static IStaticPortMappingCollection _mappings
 
static UPnPNAT _upnpnat
 
static string BanFilePath = "banlist.txt"
 
static RemoteClient[] Clients = new RemoteClient[256]
 
static RemoteServer Connection = new RemoteServer()
 
static bool Disconnect
 
static MessageBuffer fullBuffer = new MessageBuffer()
 
static bool HasClients
 
static bool IsListening = true
 
static int ListenPort = 7777
 
const int MaxConnections = 256
 
const int NetBufferSize = 1024
 
static bool SaveOnServerExit = true
 
static IPAddress ServerIP
 
static string ServerIPText = ""
 
static string ServerPassword = ""
 
static bool SpamCheck = false
 
static ISocket TcpListener
 
static bool UseUPNP = true
 

Events

static Action OnDisconnect