Skip to main content

Crate terrustia_proto

Crate terrustia_proto 

Source
Expand description

Terraria network wire format.

This crate is deliberately free of I/O so that every packet can be round-tripped in a unit test without a socket. The async server lives in the terrustia crate.

Copyright (c) 2026 Brooklyn Halmstad. Licensed under the MIT licence; see the LICENSE file beside this crate’s manifest. The server that uses it is AGPL, but this crate is not: it is a description of a wire format, and holding that hostage to a licence would help nobody.

Re-exports§

pub use error::ProtoError;
pub use error::Result;
pub use item::ItemStack;
pub use net_text::NetworkText;
pub use net_text::TextMode;
pub use reader::PacketReader;
pub use section::SECTION_HEIGHT;
pub use section::SECTION_WIDTH;
pub use section::SectionBounds;
pub use section::SectionExtras;
pub use tile::Liquid;
pub use tile::Tile;
pub use tile::TileFlags;
pub use writer::MAX_FRAME_LEN;
pub use writer::PacketWriter;
pub use writer::Writer;

Modules§

angler
The Angler’s daily quest, generated from the game’s own rules.
banners
Which enemies have a banner, and how many of them it takes to earn one.
buffs
Buff tables, generated from the game’s own.
conditional_drops
Loot that depends on more than the thing that died.
convert
Turning one biome into another, block by block.
difficulty
How a world’s difficulty and its player count change what an enemy is made of.
error
housing
Housing rules for town NPCs, transcribed from WorldGen.StartRoomCheck, CheckRoom and RoomNeeds in the 1.4.5.7 build.
hurt
Hurting and killing players: packets 117 (PlayerHurtV2) and 118 (PlayerDeathV2).
hurt_tiles
Which tiles hurt to stand in, generated from the game’s own sets.
id
Numeric message ids, transcribed from Terraria.ID.MessageID in the 1.4.5.7 build.
inventory
Player inventories — packet 5, SyncEquipment.
item
items
Item entities lying in the world: packets 21, 22 and 151.
locks
Locked chests and doors, and what it takes to open one.
net_module
Packet 82 carries a “net module” identified by a leading u16.
net_text
npc
NPC networking: packets 23 (SyncNPC), 28 (DamageNPC) and 162 (the damage acknowledgement).
npc_data
Stats for every NPC type, transcribed from NPC.SetDefaults in the 1.4.5.7 build.
npc_drops
What NPCs drop when they die, generated from ItemDropDatabase.
npc_params
Per-type parameters pulled out of the game’s AI routines.
objects
Packets for the interactive world objects: chests, signs and doors.
orbs
Shadow orbs and crimson hearts: what breaking one gives you.
packets
Typed packets for the connection handshake and player sync.
placed_items
Which item a placed object gives back when it is mined.
player_info
Decoding packet 4 (SYNC_PLAYER, PlayerInfo): what a client says about how it looks.
prehardmode
The pre-hardmode NPC roster.
projectile
Projectile networking: packets 27 (SyncProjectile) and 29 (KillProjectile).
projectile_data
Stats for every projectile the game defines, generated from Projectile.SetDefaults.
reader
recipes
What crafted things are made of, generated from the game’s recipes.
section
Tile section coding — packet 10.
shimmer
What shimmer turns things into, generated from the game’s own tables.
square
Packet 20, AreaTileChange — a small rectangle of tiles pushed as a unit.
statues
What each statue does when a circuit reaches it.
tile
tile_drops
Which item a tile drops when it is mined.
tile_entity
Tile entities: the furniture that remembers something.
tile_object
Multi-tile objects — how big each one is and how its frames are laid out.
tile_sets
Tile type property tables, transcribed from the 1.4.5.7 build.
tile_solid
Which tile types block movement.
touch_debuffs
What touching an enemy does to you beyond the damage.
town_names
The names town NPCs are given, generated from the game’s own lists.
travel_shop
The Travelling Merchant’s stock, generated from the game’s own chain.
writer