![]() |
tModLoader v2025.07
A mod to make and play Terraria mods
|
Classes | |
struct | NetSoundInfo |
Static Public Member Functions | |
static void | BootPlayer (int plr, NetworkText msg) |
static void | CheckBytes (int bufferIndex=256) |
static void | CompressTileBlock (int xStart, int yStart, short width, short height, Stream stream) |
static void | CompressTileBlock_Inner (BinaryWriter writer, int xStart, int yStart, int width, int height) |
static void | DecompressTileBlock (Stream stream) |
static void | DecompressTileBlock_Inner (BinaryReader reader, int xStart, int yStart, int width, int height) |
static bool | DoesPlayerSlotCountAsAHost (int plr) |
static void | greetPlayer (int plr) |
static void | PlayNetSound (NetSoundInfo info, int remoteClient=-1, int ignoreClient=-1) |
static void | ReceiveBytes (byte[] bytes, int streamLength, int i=256) |
static void | SendAnglerQuest (int remoteClient) |
static void | SendCoinLossRevengeMarker (CoinLossRevengeSystem.RevengeMarker marker, int remoteClient=-1, int ignoreClient=-1) |
static void | SendData (int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0) |
Used to send a vanilla MessageID message to send data between the server and client. This is the vanilla equivalent to ModPacket. Vanilla messages are usually automatically sent by the game, but there are cases where manually sending a vanilla message is useful. To get started with learning netcode, read the Basic Netcode wiki guide. To use this method, pass a MessageID value into msgType parameter. The remaining parameters (text and number0-7) need to be populated with appropriate values according to the documentation of that specific MessageID. When in doubt, consult the decompiled source code. ignoreClient and remoteClient : When called on a client, the data will be sent to the server and ignoreClient and remoteClient are ignored. When called on a server, the data will be sent to either all clients, all clients except a specific client, or just a specific client depending on the values of ignoreClient and remoteClient . The MessageBuffer.GetData(int, int, out int) method is what handles these messages when received. | |
static void | SendObjectPlacement (int whoAmi, int x, int y, int type, int style, int alternative, int random, int direction) |
static void | SendPlayerDeath (int playerTargetIndex, PlayerDeathReason reason, int damage, int direction, bool pvp, int remoteClient=-1, int ignoreClient=-1) |
static void | SendPlayerHurt (int playerTargetIndex, Player.HurtInfo info, int ignoreClient=-1) |
static void | SendSection (int whoAmi, int sectionX, int sectionY) |
static void | SendStrikeNPC (NPC npc, in NPC.HitInfo hit, int ignoreClient=-1) |
Use this to synchronize damage strikes against NPCs! | |
static void | SendTemporaryAnimation (int whoAmi, int animationType, int tileType, int xCoord, int yCoord) |
static void | SendTileSquare (int whoAmi, int tileX, int tileY, int centeredSquareSize, TileChangeType changeType=TileChangeType.None) |
Range: In this particular overload, tileX and tileY denote the center of a square range of tiles to sync and centeredSquareSize denotes the width/height of the square to send. Odd centeredSquareSize values result in a square centered directly on tileX and tileY , while even values will result in the square being 1 tile longer to the right of and below of the coordinates. The SendTileSquare(int, int, int, int, int, TileChangeType) overload is usually preferred to this because it sends the exact range of tiles desired and visualizing how the square range fits over the desired range of tiles can be hard to visualize and program correctly. | |
static void | SendTileSquare (int whoAmi, int tileX, int tileY, int xSize, int ySize, TileChangeType changeType=TileChangeType.None) |
Range: In this particular overload, tileX and tileY denote the top left corner of tiles to sync and xSize and ySize denote the width and height of the rectangle. More... | |
static void | SendTileSquare (int whoAmi, int tileX, int tileY, TileChangeType changeType=TileChangeType.None) |
Range: In this particular overload, tileX and tileY denote a single tile to sync. If sending multiple tiles use the other overloads instead. | |
static void | SendTravelShop (int remoteClient) |
static void | sendWater (int x, int y) |
static void | SyncConnectedPlayer (int plr) |
static void | SyncDisconnectedPlayer (int plr) |
static bool | TrySendData (int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0) |
Static Public Attributes | |
static PlayerDeathReason | _currentPlayerDeathReason |
static MessageBuffer[] | buffer = new MessageBuffer[257] |
|
static |
Range: In this particular overload, tileX and tileY denote the top left corner of tiles to sync and xSize and ySize denote the width and height of the rectangle.
<SharedSummary> Sends all the tiles in a rectangle range to sync them. The range is defined by parameters explained below.
whoAmi should usually be -1. changeType can optionally be set to one of the TileChangeType to automatically play the corresponding liquid sound on the receiving clients.
If called on a client, the server will relay the changed tiles to other clients when it is received.
Use this method when manually adjusting Main.tile. Uses such as wiring, right clicking on tiles, tiles randomly updating, and projectiles modifying tiles are all exhibited in ExampleMod
.
</SharedSummary>