Skip to content

[upcoming] 3. Existing modifications

Luke edited this page Aug 2, 2021 · 6 revisions
Contents
1. Runtime Events
2. Client mods
3. PC Server mods
4. Mobile Server mods
5. tModLoader Server mods

This page is a manually updated list of modifications that are currently used to produce OTAPI. They are generated during a patch using the OTAPI.Patcher project.
Note: Documentation is still being written

Runtime Events

OTAPI.Runtime.dll is a file generated by MonoMod, which has created events to subscribe to of every single static and member method in the Terraria assembly.
This dll alone reduces the majority of the patches just down to event subscriptions and redirecting the code flow, or wrapping hooks around these flows.

JavaScript is probably the best example of current ways to use it

Client mods

Type Mod Platforms Comment
module System.Windows.Forms Client & Server Shims and relinks System.Windows.Forms
script Test.Client.js Client Example javascript modification. Does nothing apart from call the Modder CLR instance.
script module-test-both/index.js Client & Server Example javascript module. Does nothing apart from call the Modder CLR instance.
toplevel ChangeAssemblyName.Both.cs Client & Server A mod to change the Terraria or TerrariaServer name to OTAPI so cross platform plugins only need to reference one assembly name
toplevel HookClientGetData.Both.cs Client & Server A mod to create Hooks.MessageBuffer.GetData. Allows plugins to process received packet data.
toplevel HookMainCtor.Client.cs Client Creates Hooks.Main.Create. Allows plugins to extend and return a custom Terraria.Main instance.
toplevel HookMainStatusText.cs A mod to create Hooks.Main.StatusTextUpdate. Allows plugins to receive writes to Main.statusText.
toplevel HookNpcSpawn.Both.cs Client & Server Creates Hooks.NPC.Spawn. Allows plugins to cancel NPC spawns.
toplevel ModifyFileOperationAPIWrapper.Client.cs Client Patches FileOperationAPIWrapper.SHFILEOPSTRUCT to work for x64
toplevel RemoveReLogicResource.cs Removes ReLogic.dll from embedded resources as its replaced
toplevel RemoveSteamResource.cs Removes steam from embedded resources as its replaced
patch Terraria.Entity.Both.cs Client & Server Patches the entity class to allow instance mods.
patch Terraria.NetMessage.Both.cs Client & Server Creates Hooks.NetMessage.SendData. Allows plugins to listen on packet requests.
patch Terraria.Program.Both.cs Client & Server Fixes platform issues in Terraria.Program.DisplayException
patch Terraria.Program.Both.cs Client & Server Initiates the client module system
script Test.Client.lua Client Example lua modification. Does nothing apart from call the Modder CLR instance.

PC Server mods

Type Mod Platforms Comment
module Microsoft.Win32.Registry Server Shims and relinks Microsoft.Win32.Registry
module System.Drawing Server Shims and relinks System.Drawing.Graphics
module System.Windows.Forms Client & Server Shims and relinks System.Windows.Forms
module Xna Server Shims and relinks Microsoft.Xna.Framework
script clearscript\module-test-both\index.js Client & Server Example javascript module. Does nothing apart from call the Modder CLR instance.
toplevel ChangeAssemblyName.Both.cs Client & Server A mod to change the Terraria or TerrariaServer name to OTAPI so cross platform plugins only need to reference one assembly name
toplevel ClientGetDataExceptions.Server.cs Server A mod to insert Hooks.NetMessage.CheckBytesException and will default to printing to the console
toplevel EnableServerSideCharacters.Server.cs Server Attaches newtwork packets to the Terraria.Main.ServerSideCharacter variable. This allows sub projects like TShock to activate SSC.
toplevel HookClientGetData.Both.cs Client & Server A mod to create Hooks.MessageBuffer.GetData. Allows plugins to process received packet data.
toplevel HookClientSendBytes.Server.cs Server Creates Hooks.NetMessage.SendBytes. Allows plugins to intercept the sending of data.
toplevel HookClientSockets.Server.cs Server Creates Hooks.Netplay.CreateTcpListener. Allows custom TCP implementations to be used.
toplevel HookCommandProcessing.Server.cs Server Creates Hooks.Main.CommandProcess. Allows plugins to intercept issued commands.
toplevel HookHardModeTilePlacement.Server.cs Server Creates Hooks.WorldGen.HardmodeTilePlace. Allows plugins to intercept hard mode tile placements.
toplevel HookHardModeTileUpdates.Server.cs Server Creates Hooks.WorldGen.HardmodeTileUpdate. Allows plugins to intercept hard mode tile updates.
toplevel HookMainStatusText.cs A mod to create Hooks.Main.StatusTextUpdate. Allows plugins to receive writes to Main.statusText.
toplevel HookMechSpawn.Server.cs Server Creates Hooks.NPC.MechSpawn & Hooks.Item.MechSpawn. Allows plugins to react to Mech spawn events.
toplevel HookMeteors.Server.cs Server Creates Hooks.WorldGen.Meteor. Allows plugins to cancel meteors.
toplevel HookNpcBossBag.Server.cs Server Creates Hooks.NPC.BossBag. Allows plugins to cancel boss bag items.
toplevel HookNpcKilled.Server.cs Server Creates Hooks.NPC.Killed. Allows plugins to cancel NPC killed events.
toplevel HookNpcLoot.Server.cs Server Creates Hooks.NPC.DropLoot. Allows plugins to alter or cancel NPC loot drops.
toplevel HookNpcSpawn.Both.cs Client & Server Creates Hooks.NPC.Spawn. Allows plugins to cancel NPC spawns.
toplevel HookNpcTransform.Server.cs Server Creates Hooks.NPC.Transform. Allows plugins to cancel NPC killed events.
toplevel HookPlayerAnnouncements.Server.cs Server Creates Hooks.NetMessage.PlayerAnnounce. Allows plugins to intercept the vanilla join message.
toplevel HookPlayerNameCollision.Server.cs Server Creates Hooks.MessageBuffer.NameCollision. Allows plugins to control and cancel name collisions when 2 players join with the same name.
toplevel HookWiringAnnouncementBox.Server.cs Server Creates Hooks.Wiring.AnnouncementBox. Allows plu
toplevel ITile.Server.cs Server Transforms Terraria.Tile into Terraria.ITile
toplevel ITileCollection.Server.cs Server Transforms Terraria.Tile[] types to ModFramework.DefaultCollection
toplevel ITileProperties.Server.cs Server Transforms the fields of Terraria.Tile into properties
toplevel ModifyVanillaTile.Server.cs Server Implements Terraria.Tile.Initialise in place of Terraria.Tile.ctor. This allows the port to an interface work much easier.
toplevel OnPacketWrite.Server.cs Server Creates Terraria.NetMessage.OnPacketWrite that mods can use t osend custom packets using the vanilla interface.
toplevel PatchClientUUID.Server.cs Server Patch in a custom Terraria.RemoteClient.ClientUUID property, and hooks it up into the network protocol.
toplevel PatchNetplayBroadcast.Server.cs Server Fix Terraria.Netplay.BroadcastThread infinite loop.
toplevel PatchNewtonsoftjson.Server.cs Server A mod to update Newtonsoft.Json assembly references.
toplevel PatchSendDataLocks.Server.cs Server Removes sync lock functionality in Terraria.NetMessage.SendData, used in conjunction with the SendDataWriter patch.
toplevel PatchSendDataWriter.Server.cs Server Replaces a global write buffer to a local variable buffer, used in conjunction of the SendDataLocks patch
toplevel PatchZeroLengthPackets.Server.cs Server Prevent infinite server loop. refer to https://github.com/Pryaxis/TShock/issues/1673
toplevel RemoveMap.Server.cs Server Disables the world map to be created on the server (it is not needed, at least on vanilla).
toplevel RemoveReLogicResource.cs Removes ReLogic.dll from embedded resources as its replaced
toplevel RemoveSteamResource.cs Removes steam from embedded resources as its replaced
toplevel SaveAndPlay.Server.cs Server Adds a Terraria.WorldGen.autoSave check in saveAndPlay
patch HookChestQuickStack.Server.cs Server Creates Hooks.Chest.QuickStack.
patch ModifyCollisionSwitchTiles.Server.cs Server Creates Hooks.Collision.PressurePlate.
patch PatchNpcStrikeArgs.Server.cs Server Adds a Terraria.Entity entity parameter to Terraria.NPC.StrikeNPC.
patch ReLogic.OS.Platform.Server.cs Server Fixes ReLogic.OS.Platform.Current using RuntimeInformation
patch Terraria.Collision.Server.cs Server Fixes "Index out of range" exceptions wihin Terraria.Collision.GetEntityEdgeTiles
patch Terraria.Entity.Both.cs Client & Server Patches the entity class to allow instance mods.
patch Terraria.ID.ItemID.Sets.Server.cs Server Adds a new Terraria.ID.ItemID.Sets.Explosives variable.
patch Terraria.Main.Server.cs Server Enable Terraria.Main.NeverSleep calls based off updated ReLogic.OS.Platform.IsWindows
patch Terraria.Main.Server.cs Server Fixes auto save when Terraria.Main.autoSave is false
patch Terraria.NetMessage.Both.cs Client & Server Creates Hooks.NetMessage.SendData. Allows plugins to listen on packet requests.
patch Terraria.Program.Both.cs Client & Server Fixes platform issues in Terraria.Program.DisplayException
patch Terraria.Program.Both.cs Client & Server Initiates the client module system
patch Terraria.RemoteClient.Server.cs Server Adds a Terraria.RemoteClient.Data variable for data storage.
patch Terraria.Utilities.FileOperationAPIWrapper.Server.cs Server Fixes cross platform file removal
patch Terraria.WindowsLaunch.Server.cs Server Improves cross platform launch checks

Mobile Server mods

Type Mod Platforms Comment
module Microsoft.Win32.Registry Server Shims and relinks Microsoft.Win32.Registry
module System.Drawing Server Shims and relinks System.Drawing.Graphics
module System.Windows.Forms Client & Server Shims and relinks System.Windows.Forms
module Xna Server Shims and relinks Microsoft.Xna.Framework
script clearscript\module-test-both\index.js Client & Server Example javascript module. Does nothing apart from call the Modder CLR instance.
toplevel ChangeAssemblyName.Both.cs Client & Server A mod to change the Terraria or TerrariaServer name to OTAPI so cross platform plugins only need to reference one assembly name
toplevel ClientGetDataExceptions.Server.cs Server A mod to insert Hooks.NetMessage.CheckBytesException and will default to printing to the console
toplevel EnableServerSideCharacters.Server.cs Server Attaches newtwork packets to the Terraria.Main.ServerSideCharacter variable. This allows sub projects like TShock to activate SSC.
toplevel HookClientGetData.Both.cs Client & Server A mod to create Hooks.MessageBuffer.GetData. Allows plugins to process received packet data.
toplevel HookClientSendBytes.Server.cs Server Creates Hooks.NetMessage.SendBytes. Allows plugins to intercept the sending of data.
toplevel HookClientSockets.Server.cs Server Creates Hooks.Netplay.CreateTcpListener. Allows custom TCP implementations to be used.
toplevel HookCommandProcessing.Server.cs Server Creates Hooks.Main.CommandProcess. Allows plugins to intercept issued commands.
toplevel HookHardModeTilePlacement.Server.cs Server Creates Hooks.WorldGen.HardmodeTilePlace. Allows plugins to intercept hard mode tile placements.
toplevel HookHardModeTileUpdates.Server.cs Server Creates Hooks.WorldGen.HardmodeTileUpdate. Allows plugins to intercept hard mode tile updates.
toplevel HookMainStatusText.cs A mod to create Hooks.Main.StatusTextUpdate. Allows plugins to receive writes to Main.statusText.
toplevel HookMechSpawn.Server.cs Server Creates Hooks.NPC.MechSpawn & Hooks.Item.MechSpawn. Allows plugins to react to Mech spawn events.
toplevel HookMeteors.Server.cs Server Creates Hooks.WorldGen.Meteor. Allows plugins to cancel meteors.
toplevel HookNpcBossBag.Server.cs Server Creates Hooks.NPC.BossBag. Allows plugins to cancel boss bag items.
toplevel HookNpcKilled.Server.cs Server Creates Hooks.NPC.Killed. Allows plugins to cancel NPC killed events.
toplevel HookNpcLoot.Server.cs Server Creates Hooks.NPC.DropLoot. Allows plugins to alter or cancel NPC loot drops.
toplevel HookNpcSpawn.Both.cs Client & Server Creates Hooks.NPC.Spawn. Allows plugins to cancel NPC spawns.
toplevel HookNpcTransform.Server.cs Server Creates Hooks.NPC.Transform. Allows plugins to cancel NPC killed events.
toplevel HookPlayerAnnouncements.Server.cs Server Creates Hooks.NetMessage.PlayerAnnounce. Allows plugins to intercept the vanilla join message.
toplevel HookPlayerNameCollision.Server.cs Server Creates Hooks.MessageBuffer.NameCollision. Allows plugins to control and cancel name collisions when 2 players join with the same name.
toplevel HookWiringAnnouncementBox.Server.cs Server Creates Hooks.Wiring.AnnouncementBox. Allows plu
toplevel ITile.Server.cs Server Transforms Terraria.Tile into Terraria.ITile
toplevel ITileCollection.Server.cs Server Transforms Terraria.Tile[] types to ModFramework.DefaultCollection
toplevel ITileProperties.Server.cs Server Transforms the fields of Terraria.Tile into properties
toplevel ModifyVanillaTile.Server.cs Server Implements Terraria.Tile.Initialise in place of Terraria.Tile.ctor. This allows the port to an interface work much easier.
toplevel OnPacketWrite.Server.cs Server Creates Terraria.NetMessage.OnPacketWrite that mods can use t osend custom packets using the vanilla interface.
toplevel PatchClientUUID.Server.cs Server Patch in a custom Terraria.RemoteClient.ClientUUID property, and hooks it up into the network protocol.
toplevel PatchNetplayBroadcast.Server.cs Server Fix Terraria.Netplay.BroadcastThread infinite loop.
toplevel PatchNewtonsoftjson.Server.cs Server A mod to update Newtonsoft.Json assembly references.
toplevel PatchSendDataLocks.Server.cs Server Removes sync lock functionality in Terraria.NetMessage.SendData, used in conjunction with the SendDataWriter patch.
toplevel PatchSendDataWriter.Server.cs Server Replaces a global write buffer to a local variable buffer, used in conjunction of the SendDataLocks patch
toplevel PatchZeroLengthPackets.Server.cs Server Prevent infinite server loop. refer to https://github.com/Pryaxis/TShock/issues/1673
toplevel RemoveMap.Server.cs Server Disables the world map to be created on the server (it is not needed, at least on vanilla).
toplevel RemoveReLogicResource.cs Removes ReLogic.dll from embedded resources as its replaced
toplevel RemoveSteamResource.cs Removes steam from embedded resources as its replaced
toplevel SaveAndPlay.Server.cs Server Adds a Terraria.WorldGen.autoSave check in saveAndPlay
patch HookChestQuickStack.Server.cs Server Creates Hooks.Chest.QuickStack.
patch ModifyCollisionSwitchTiles.Server.cs Server Creates Hooks.Collision.PressurePlate.
patch PatchNpcStrikeArgs.Server.cs Server Adds a Terraria.Entity entity parameter to Terraria.NPC.StrikeNPC.
patch ReLogic.OS.Platform.Server.cs Server Fixes ReLogic.OS.Platform.Current using RuntimeInformation
patch Terraria.Collision.Server.cs Server Fixes "Index out of range" exceptions wihin Terraria.Collision.GetEntityEdgeTiles
patch Terraria.Entity.Both.cs Client & Server Patches the entity class to allow instance mods.
patch Terraria.ID.ItemID.Sets.Server.cs Server Adds a new Terraria.ID.ItemID.Sets.Explosives variable.
patch Terraria.Main.Server.cs Server Enable Terraria.Main.NeverSleep calls based off updated ReLogic.OS.Platform.IsWindows
patch Terraria.Main.Server.cs Server Fixes auto save when Terraria.Main.autoSave is false
patch Terraria.NetMessage.Both.cs Client & Server Creates Hooks.NetMessage.SendData. Allows plugins to listen on packet requests.
patch Terraria.Program.Both.cs Client & Server Fixes platform issues in Terraria.Program.DisplayException
patch Terraria.Program.Both.cs Client & Server Initiates the client module system
patch Terraria.RemoteClient.Server.cs Server Adds a Terraria.RemoteClient.Data variable for data storage.
patch Terraria.Utilities.FileOperationAPIWrapper.Server.cs Server Fixes cross platform file removal
patch Terraria.WindowsLaunch.Server.cs Server Improves cross platform launch checks

tModLoader Server mods

Type Mod Platforms Comment
module Microsoft.Win32.Registry Server Shims and relinks Microsoft.Win32.Registry
module System.Drawing Server Shims and relinks System.Drawing.Graphics
module System.Windows.Forms Client & Server Shims and relinks System.Windows.Forms
module Xna Server Shims and relinks Microsoft.Xna.Framework
script clearscript\module-test-both\index.js Client & Server Example javascript module. Does nothing apart from call the Modder CLR instance.
toplevel ChangeAssemblyName.Both.cs Client & Server A mod to change the Terraria or TerrariaServer name to OTAPI so cross platform plugins only need to reference one assembly name
toplevel ClientGetDataExceptions.Server.cs Server A mod to insert Hooks.NetMessage.CheckBytesException and will default to printing to the console
toplevel EnableServerSideCharacters.Server.cs Server Attaches newtwork packets to the Terraria.Main.ServerSideCharacter variable. This allows sub projects like TShock to activate SSC.
toplevel HookClientSendBytes.Server.cs Server Creates Hooks.NetMessage.SendBytes. Allows plugins to intercept the sending of data.
toplevel HookHardModeTilePlacement.Server.cs Server Creates Hooks.WorldGen.HardmodeTilePlace. Allows plugins to intercept hard mode tile placements.
toplevel HookHardModeTileUpdates.Server.cs Server Creates Hooks.WorldGen.HardmodeTileUpdate. Allows plugins to intercept hard mode tile updates.
toplevel HookMechSpawn.Server.cs Server Creates Hooks.NPC.MechSpawn & Hooks.Item.MechSpawn. Allows plugins to react to Mech spawn events.
toplevel HookNpcBossBag.Server.cs Server Creates Hooks.NPC.BossBag. Allows plugins to cancel boss bag items.
toplevel HookNpcKilled.Server.cs Server Creates Hooks.NPC.Killed. Allows plugins to cancel NPC killed events.
toplevel HookNpcSpawn.Both.cs Client & Server Creates Hooks.NPC.Spawn. Allows plugins to cancel NPC spawns.
toplevel HookNpcTransform.Server.cs Server Creates Hooks.NPC.Transform. Allows plugins to cancel NPC killed events.
toplevel HookPlayerNameCollision.Server.cs Server Creates Hooks.MessageBuffer.NameCollision. Allows plugins to control and cancel name collisions when 2 players join with the same name.
toplevel HookWiringAnnouncementBox.Server.cs Server Creates Hooks.Wiring.AnnouncementBox. Allows plu
toplevel ITile.Server.cs Server Transforms Terraria.Tile into Terraria.ITile
toplevel ITileCollection.Server.cs Server Transforms Terraria.Tile[] types to ModFramework.DefaultCollection
toplevel ITileProperties.Server.cs Server Transforms the fields of Terraria.Tile into properties
toplevel ModifyVanillaTile.Server.cs Server Implements Terraria.Tile.Initialise in place of Terraria.Tile.ctor. This allows the port to an interface work much easier.
toplevel OnPacketWrite.Server.cs Server Creates Terraria.NetMessage.OnPacketWrite that mods can use t osend custom packets using the vanilla interface.
toplevel PatchClientUUID.Server.cs Server Patch in a custom Terraria.RemoteClient.ClientUUID property, and hooks it up into the network protocol.
toplevel PatchNewtonsoftjson.Server.cs Server A mod to update Newtonsoft.Json assembly references.
toplevel PatchSendDataLocks.Server.cs Server Removes sync lock functionality in Terraria.NetMessage.SendData, used in conjunction with the SendDataWriter patch.
toplevel PatchSendDataWriter.Server.cs Server Replaces a global write buffer to a local variable buffer, used in conjunction of the SendDataLocks patch
toplevel PatchZeroLengthPackets.Server.cs Server Prevent infinite server loop. refer to https://github.com/Pryaxis/TShock/issues/1673
toplevel RemoveReLogicResource.cs Removes ReLogic.dll from embedded resources as its replaced
toplevel RemoveSteamResource.cs Removes steam from embedded resources as its replaced
toplevel SaveAndPlay.Server.cs Server Adds a Terraria.WorldGen.autoSave check in saveAndPlay
patch HookChestQuickStack.Server.cs Server Creates Hooks.Chest.QuickStack.
patch ReLogic.OS.Platform.Server.cs Server Fixes ReLogic.OS.Platform.Current using RuntimeInformation
patch Terraria.Collision.Server.cs Server Fixes "Index out of range" exceptions wihin Terraria.Collision.GetEntityEdgeTiles
patch Terraria.Entity.Both.cs Client & Server Patches the entity class to allow instance mods.
patch Terraria.ID.ItemID.Sets.Server.cs Server Adds a new Terraria.ID.ItemID.Sets.Explosives variable.
patch Terraria.Main.Server.cs Server Enable Terraria.Main.NeverSleep calls based off updated ReLogic.OS.Platform.IsWindows
patch Terraria.Main.Server.cs Server Fixes auto save when Terraria.Main.autoSave is false
patch Terraria.ModLoader.FrameworkVersion.cs Fixes TML loading on net5
patch Terraria.NetMessage.Both.cs Client & Server Creates Hooks.NetMessage.SendData. Allows plugins to listen on packet requests.
patch Terraria.Program.Both.cs Client & Server Fixes platform issues in Terraria.Program.DisplayException
patch Terraria.Program.Both.cs Client & Server Initiates the client module system
patch Terraria.RemoteClient.Server.cs Server Adds a Terraria.RemoteClient.Data variable for data storage.
patch Terraria.Utilities.FileOperationAPIWrapper.Server.cs Server Fixes cross platform file removal
patch Terraria.WindowsLaunch.Server.cs Server Improves cross platform launch checks