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

Vanilla netcode messages. These are used in NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int) to send data between the server and clients. The documentation of each MessageID value explains the the purpose of the message and most importantly the meaning of each of the SendData parameters for that message. More...

Static Public Member Functions

static string GetName (int id)
 

Static Public Attributes

const byte AchievementMessageEventHappened = 98
 
const byte AchievementMessageNPCKilled = 97
 
const byte AddNPCBuff = 53
 
const byte AddPlayerBuff = 55
 
const byte AnglerQuest = 74
 
const byte AnglerQuestFinished = 75
 
const byte BugCatching = 70
 
const byte BugReleasing = 71
 
const byte ChatText = 25
 
const byte ChestName = 69
 
const byte ChestUpdates = 34
 
const byte ClientSyncedInventory = 138
 
const byte ClientUUID = 68
 
const byte CombatTextInt = 81
 Sends a CombatText from the server to clients. Sends a number, use CombatTextString instead for the string version. Used automatically by Player.HealEffect(int, bool), but custom CombatText would need to manually sync using this message.

NetMessage.SendData parameters, correlating to CombatText.NewText(Microsoft.Xna.Framework.Rectangle, Microsoft.Xna.Framework.Color, int, bool, bool) parameters:
number: The text color: Microsoft.Xna.Framework.Color.PackedValue
number2: The CombatText center X coordinate
number3: The CombatText center Y coordinate
number4: The number shown by the CombatText
 
const byte CombatTextString = 119
 Sends a CombatText from the server to clients. Sends a string, use CombatTextInt instead for the int version. Used automatically by Player.HealEffect(int, bool), but custom CombatText would need to manually sync using this message. NetMessage.SendData parameters, correlating to CombatText.NewText(Microsoft.Xna.Framework.Rectangle, Microsoft.Xna.Framework.Color, string, bool, bool) parameters:
number: The text color: Microsoft.Xna.Framework.Color.PackedValue
number2: The CombatText center X coordinate
number3: The CombatText center Y coordinate
text: The text shown by the CombatText
 
static readonly byte Count = 149
 
const byte CrystalInvasionRequestedToSkipWaitTime = 143
 
const byte CrystalInvasionSendWaitTime = 116
 
const byte CrystalInvasionStart = 113
 
const byte CrystalInvasionWipeAllTheThingsss = 114
 
const byte DamageNPC = 28
 
const byte DeadPlayer = 135
 
const byte Deprecated1 = 94
 
const byte Dodge = 62
 
const byte Emoji = 120
 
const byte FinishedConnectingToServer = 129
 
const byte FishOutNPC = 130
 
const byte FoodPlatterTryPlacing = 133
 
const byte GemLockToggle = 105
 
const byte Hello = 1
 
const byte HitSwitch = 59
 
const byte HurtPlayer = 26
 
const byte InGameChangeConfig = 249
 Sent by Clients who wish to change ConfigScope.ServerSide ModConfigs. Clients send Modname, configname, broadcast, and json string.

Server determines if ModConfig.ReloadRequired and ModConfig.ShouldAcceptClientChanges. Replies with ShouldAcceptClientChanges message if rejected.

Client receives bool success, message, modname, configname, broadcast, requestor player, if success additionally json, and applies them locally.
 
const byte InitialSpawn = 49
 
const byte InstancedItem = 90
 Exactly the same as SyncItem, but sets the instanced flag and is only sent server -> client. Used by loot that is dropped per player, like boss bags.

SyncItem docs:


 
const byte InstrumentSound = 58
 
const byte InvasionProgressReport = 78
 
const byte ItemFrameTryPlacing = 89
 
const byte ItemOwner = 22
 
const byte ItemTweaker = 88
 
const byte KeepAliveDuringModReload = 253
 Sent periodically while mods are reloading to keep connection alive. Default timeout is 2 minutes, which a large modpack might need to reload.
 
const byte Kick = 2
 
const byte KillPlayer = 44
 
const byte KillProjectile = 29
 
const byte LandGolfBallInCup = 128
 
const byte LiquidUpdate = 48
 
const byte LockAndUnlock = 52
 Unlocks or locks the chest or door at the provided tile coordinates. The server will also sync the changed tiles to all clients.


Modders should use this message exactly as shown in ExampleChest.

NetMessage.SendData parameters:
number2: UnlockType. 1->Chest.Unlock, 2->WorldGen.UnlockDoor, 3->Chest.Lock
number3: x tile coordinate of the chest (top left corner)
number4: y tile coordinate of the chest (top left corner)

Forwarded to other clients
 
const byte ManaEffect = 43
 
const byte MassWireOperation = 109
 
const byte MassWireOperationPay = 110
 
const byte MinionAttackTargetUpdate = 115
 
const byte MinionRestTargetUpdate = 99
 
const byte MiscDataSync = 51
 
const byte ModFile = 252
 The server receives the name of one of the mods sent in SyncMods

Sends one packet containing the display name and length, then a series of packets containing up to 64k bytes containing the contents of the file

Client displays the downloading mod UI when it receives the first packet with display name and length More...
 
const byte ModPacket = 250
 Contains a netID followed by custom data sent by mods
Special case netID == -1, is sent by the server in response to SyncMods and contains the netIDs of every non-server only mod
NetIDs will be sent for no-sync mods, and packets will be ignored if the mod is not installed on the client
 
const byte MoonlordHorror = 103
 
const byte MurderSomeoneElsesPortal = 95
 
const byte NebulaLevelupRequest = 102
 
const byte NetModules = 82
 
const byte NeverCalled = 0
 
const byte NPCBuffs = 54
 
const byte NPCHome = 60
 
const byte NPCKillCountDeathTally = 83
 
const byte PaintTile = 63
 
const byte PaintWall = 64
 
const byte PlaceObject = 79
 
const byte PlayerActive = 14
 
const byte PlayerBuffs = 50
 
const byte PlayerControls = 13
 Syncs the player's movement keystates, item actions, grapple, gravity, stealth and velocity. Primarily sent from sync with clientClone.

NetMessage.SendData parameters:
number: The player.whoAmI of the player

Forwarded to other clients
 
const byte PlayerDeathV2 = 118
 
const byte PlayerHeal = 35
 
const byte PlayerHurtV2 = 117
 
const byte PlayerInfo = 3
 
const byte PlayerLifeMana = 16
 
const byte PlayerMana = 42
 
const byte PlayerSpawn = 12
 
const byte PlayerStealth = 84
 
const byte PlayerTeam = 45
 
const byte PlayLegacySound = 132
 
const byte PoofOfSmoke = 106
 
const byte QuestsCountSync = 76
 
const byte QuickStackChests = 85
 
const byte ReadSign = 47
 
const byte ReleaseItemOwnership = 39
 
const byte RemoveRevengeMarker = 127
 
const byte RequestChestOpen = 31
 Sent from a client to request access to a Chest. Clients have to request access to chests for the server to send the current chest contents and to avoid networking bugs that could arise from network lag and multiple clients interacting with the same chest inventory.

If not in use by another client, the server will reply with SyncChestItem for each item in the chest and then SyncPlayerChest. Other clients are sent the SyncPlayerChestIndex message.

Modders should use this message exactly as shown in ExampleChest.

NetMessage.SendData parameters:
number: x tile coordinate of the chest (top left corner)
number2: y tile coordinate of the chest (top left corner)

Client->Server only
 
const byte RequestLucyPopup = 141
 
const byte RequestNPCBuffRemoval = 137
 
const byte RequestPassword = 37
 
const byte RequestQuestEffect = 144
 
const byte RequestReadSign = 46
 
const byte RequestTeleportationByServer = 73
 Teleports the client to set locations using one of 4 teleport methods. Use TeleportEntity instead to teleport to arbitrary coordinates.

When using any of these teleport methods in multiplayer, make sure to use this instead of calling the methods directly on the client.

NetMessage.SendData parameters:
number: The teleportation method to call:
0->Player.TeleportationPotion (Random Location), 1->Player.MagicConch (Ocean), 2->Player.DemonConch (Underworld), 3->Player.Shellphone_Spawn (World spawn point).

Client->Server only
 
const byte RequestTileEntityInteraction = 122
 
const byte RequestWorldData = 6
 
static readonly IdDictionary Search = IdDictionary.Create<MessageID, byte>()
 
const byte SendPassword = 38
 
const byte SetCountsAsHostForGameplay = 139
 
const byte SetMiscEventValues = 140
 
const byte SetTime = 18
 
const byte ShimmerActions = 146
 
const byte ShopOverride = 104
 
const byte ShotAnimationAndSound = 41
 
const byte SmartTextMessage = 107
 
const byte SocialHandshake = 93
 
const byte SpawnBossUseLicenseStartEvent = 61
 Attempts to spawn an NPC on the player, start a specific event, or use a pet license. Spawned NPC must be in NPCID.Sets.MPAllowedEnemies, this will not allow multiple to spawn.

Mods should use this in boss spawner items to spawn a boss.

NetMessage.SendData parameters:
number: The player.whoAmI of the player to spawn on.
number2: If positive, this is the NPC type to spawn. If negative, this is a special event value from one of the following: GoblinArmy: -1, FrostLegion: -2, Pirates: -3, PumpkinMoon: -4, SnowMoon: -5, Eclipse: -6, MartianInvation: -7, MoonLordTimer: -8, BloodMoon: -10, NPC.combatBookWasUsed: -11, Pet License: -12 through -15, MechQueen: 16, NPC.combatBookVolumeTwoWasUsed: -17, NPC.peddlersSatchelWasUsed: -18,

Client->Server only
 
const byte SpawnTileData = 8
 
const byte SpecialFX = 112
 
const byte SpiritHeal = 66
 
const byte StatusTextSize = 9
 
const byte SyncCavernMonsterType = 136
 
const byte SyncChestItem = 32
 Syncs the item in a specific chest slot.

NetMessage.SendData parameters:
number: The index of the chest within the Main.chest array
number2: The index of the item within that chest's Chest.item array
 
const byte SyncEmoteBubble = 91
 
const byte SyncEquipment = 5
 
const byte SyncExtraValue = 92
 
const byte SyncItem = 21
 Syncs all info about an item in the world, includding modded data.

Use this whenever an item in the world is manipulated. Item.NewItem calls this automatically on the server to sync the item with other clients, but on clients this needs to be used or Player.QuickSpawnItem should be used instead.

NetMessage.SendData parameters:
number: The index of the item within Main.item
number2: Set to 1 to ignore the delay for the spawning client to pickup the item. The noGrabDelay parameter of Item.NewItem sets this.

Forwarded to other clients
 
const byte SyncItemCannotBeTakenByEnemies = 148
 Exactly the same as SyncItem, but also syncs Item.timeLeftInWhichTheItemCannotBeTakenByEnemies. Used by the Lucky Coin OnHit effect.

SyncItem docs:


 
const byte SyncItemsWithShimmer = 145
 Exactly the same as SyncItem, but also syncs Item.shimmered and Item.shimmerTime. Used when an item is transformed in shimmer.

SyncItem docs:


 
const byte SyncLoadout = 147
 
const byte SyncMods = 251
 Sent instead of LoadPlayer for non-vanilla clients
- value of ModNet.AllowVanillaClients is synchronized for common net spec
- list of all mods loaded on the server with side == Both {name, version, hash, isBrowserSigned}
The client then enables/disables mods to ensure a matching mod set
If the client is missing a mod, or has a different hash, it sends ModFile with the name of the mod
If mod downloading is disabled, or only signed mods are accepted, and the given mod isn't signed, an error message is displayed
If there are no mods to be downloaded, a reload may be performed if necessary, and then the client returns SyncMods
when the server receives SyncMods, it sends ModPacket with the netIDs and then LoadPlayer
 
const byte SyncNPC = 23
 Sends all info about an NPC, position, velocity, and AI. This includes modded data from ModNPC.SendExtraAI(System.IO.BinaryWriter) and GlobalNPC.SendExtraAI(NPC, ModLoader.IO.BitWriter, System.IO.BinaryWriter).

Use this when manually spawning an NPC on the server using a NPC.NewNPC.

NetMessage.SendData parameters:
number: The index of the spawned NPC within the Main.npc array

Server->Clients only
 
const byte SyncPlayer = 4
 
const byte SyncPlayerChest = 33
 Syncs basic information about a chest. Used on clients to send chest name changes to the server (the server then syncs the name change to other clients via ChestName). Used on the server to allow a specific client to open the chest the client previously requested to open via a RequestChestOpen message. Other clients are sent the SyncPlayerChestIndex message.

Modders should use this message exactly as shown in ExampleChest.

NetMessage.SendData parameters:
text: The name of the chest. NetworkText.FromLiteral(Main.chest[chestIndex].name) should be used. Only relevant if number2 is set to 1.
number: The index of the chest within the Main.chest array. This is typically Player.chest.
number2: If 1, then the text parameter (chest name) is being synced.
 
const byte SyncPlayerChestIndex = 80
 
const byte SyncPlayerZone = 36
 
const byte SyncProjectile = 27
 
const byte SyncProjectileTrackers = 142
 
const byte SyncRevengeMarker = 126
 
const byte SyncTalkNPC = 40
 
const byte SyncTilePicking = 125
 
const byte TamperWithNPC = 131
 
const byte TEDisplayDollItemSync = 121
 
const byte TEHatRackItemSync = 124
 
const byte TeleportEntity = 65
 Teleports the player (or an NPC) to a provided world coordinate. (Sets position, not Center)

When using any of these teleport methods in multiplayer, make sure to use this instead of calling the methods directly on the client.

NetMessage.SendData parameters:
number: teleportType: 0->Player, 1->NPC, 2->PlayerToPlayer
number2: The player.whoAmI of the player to teleport (or NPC.whoAmI for NPC teleports)
number3: The destination x world coordinate
number4: The destination y world coordinate
number5: The Style parameter of Player.Teleport(Microsoft.Xna.Framework.Vector2, int, int), controls the visuals and sounds of the teleport. Equivalent to TeleportationStyleID values.
number6: Unknown
number7: The extraInfo parameter of Player.Teleport(Microsoft.Xna.Framework.Vector2, int, int), only relevant with pylon teleporting.

Using this message for long range player teleports won't work correctly because the client might not have the destination section loaded. You might need to use a ModPacket to call RemoteClient.CheckSection(int, Microsoft.Xna.Framework.Vector2, int) on the server and then call Player.Teleport and relay this message manually.

Client->Server for player teleports, Server->Clients for NPC teleports. The player teleport message is relayed to other clients to sync the visuals.
 
const byte TeleportNPCThroughPortal = 100
 
const byte TeleportPlayerThroughPortal = 96
 
const byte TemporaryAnimation = 77
 Sends a temporary tile animation created in Animation.NewTemporaryAnimation on the server to clients.

No need to manually use this message.

NetMessage.SendData parameters:
number: Temporary tile animation ID (Animation.RegisterTemporaryAnimation(int, int[]))
number2: Tile Type
number3: x tile coordinate
number4: y tile coordinate
 
const byte TileCounts = 57
 
const byte TileEntityPlacement = 87
 Syncs a TileEntity placement attempt from a client to the server. Will cause the server to place the TileEntity and then sync it using TileEntitySharing.

This is typically used in the method contained in the ObjectData.TileObjectData.HookPostPlaceMyPlayer of the Tile placing the Tile Entity, but modders can use ModLoader.ModTileEntity.Generic_HookPostPlaceMyPlayer instead of writing custom netcode using this message.

NetMessage.SendData parameters:
number: The x tile coordinate of the TileEntity, not necessarily the top left corner of the multitile.
number2: The y tile coordinate of the TileEntity, not necessarily the top left corner of the multitile.
number3: The TileEntityID or ModLoader.ModTileEntity.Type

Client->Server only
 
const byte TileEntitySharing = 86
 Syncs the data of a TileEntity from server to clients. Will cause TileEntities to send and receive their data to sync their values. (ModLoader.ModTileEntity.NetSend(System.IO.BinaryWriter), ModLoader.ModTileEntity.NetReceive(System.IO.BinaryReader)) NetMessage.SendData parameters:
number: The DataStructures.TileEntity.ID

Server->Clients only
 
const byte TileFrameSection = 11
 
const byte TileManipulation = 17
 Sends changes made to a specific tile coordinate.

Use this whenever manipulating tiles using the WorldGen methods mentioned below.

NetMessage.SendData parameters:
number: The change type. These correspond to methods in WorldGen:
0->KillTile, 1->PlaceTile, 2->KillWall, 3->PlaceWall, 4->KillTile (No Item), 5->PlaceWire, 6->KillWire, 7->PoundTile, 8->PlaceActuator, 9->KillActuator, 10->PlaceWire2, 11->KillWire2, 10->PlaceWire3, 13->KillWire3, 14->SlopeTile, 15->Minecart.FrameTrack, 16->PlaceWire4, 17->KillWire4, 18->Wiring.PokeLogicGate, 19->Wiring.Actuate, 20->KillTile (Determine Fail On Server), 21->ReplaceTile, 22->ReplaceWall, 23->SlopeTile+PoundTile
number2: x tile coordinate
number3: y tile coordinate
number4: Changes meaning based on change type:
KillTile/KillWall/KillTile (NoItem)/KillTile (Determine Fail On Server)->Fail if 1, PlaceTile->Tile type, PlaceWall->Wall type, SlopeTile->slope value, ReplaceTile->target tile type, ReplaceWall->target wall type, SlopeTile+PoundTile->slope value,
number5: Tile style, only used with PlaceTile and ReplaceTile change types

Client->Server and Server->Clients. Automatically forwarded to other clients
 
const byte TileSection = 10
 
const byte TileSquare = 20
 Sends a square area of tile data (with upper left x, y) and given size (minimum 1)
Forwarded to other clients

This is usually used through the NetMessage.SendTileSquare(int, int, int, TileChangeType) helper methods.
 
const byte ToggleDoorState = 19
 
const byte ToggleParty = 111
 
const byte TogglePVP = 30
 
const byte TravelMerchantItems = 72
 
const byte UniqueTownNPCInfoSyncRequest = 56
 
const byte Unknown67 = 67
 
const byte Unused15 = 15
 
const byte UnusedMeleeStrike = 24
 
const byte UpdatePlayerLuckFactors = 134
 
const byte UpdateTowerShieldStrengths = 101
 
const byte WeaponsRackTryPlacing = 123
 
const byte WiredCannonShot = 108
 
const byte WorldData = 7
 Sends all of the world state data, such as time of day, weather, events, world size and name, biome info, killed bosses, etc from the server to the clients. This includes modded world data from ModLoader.ModSystem.NetSend(System.IO.BinaryWriter).

Sent whenever any of the properties in the packet change (except time of day, which gets synced whenever other properties change anyway)

Mods should send this message when manually manipulating world state data, such as a value synced in ModLoader.ModSystem.NetSend(System.IO.BinaryWriter), to keep each client in sync with the server.

NetMessage.SendData parameters: None

Server->Clients only
 

Detailed Description

Vanilla netcode messages. These are used in NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int) to send data between the server and clients. The documentation of each MessageID value explains the the purpose of the message and most importantly the meaning of each of the SendData parameters for that message.

Member Data Documentation

◆ ModFile

const byte MessageID.ModFile = 252
static

The server receives the name of one of the mods sent in SyncMods

Sends one packet containing the display name and length, then a series of packets containing up to 64k bytes containing the contents of the file

Client displays the downloading mod UI when it receives the first packet with display name and length

Once the file is downloaded, the client either sends a request for the next file, or reloads and sends SyncMods