SignatureBeef
Terrarian
Introducing the Open Terraria API version 2.0
The Open Terraria API, known as OTAPI, is a unique low-level API for Terraria that exposes events and provides performance optimisations while supporting both client and server executables on all official platforms.
You can use this modification as a NuGet package to power your own project with minimal update downtime*, or you can build plugins for NyxStudios' TShock which uses OTAPI under the hood.
How does it work?
Simple - we reuse the official binaries and add our modifications in via our patching process.
This method means we do not have to update our logic to match the new updated Terraria code, and so we can focus on adjusting our modifications (e.g. tiles, hooks, performance improvements) should they detect an abnormality.
Who is this intended for?
This is primarily intended for developers who want to create their own client or server modifications (just like TShock), as well as server administrators and GSPs who want to run the vanilla server with the ability to have better memory usage.
Want to help?
Simply head on over to TShock and join the Discord chat to get in the loop. A number of the developers here are familiar with the project and can help you.
The Open Terraria API, known as OTAPI, is a unique low-level API for Terraria that exposes events and provides performance optimisations while supporting both client and server executables on all official platforms.
You can use this modification as a NuGet package to power your own project with minimal update downtime*, or you can build plugins for NyxStudios' TShock which uses OTAPI under the hood.
How does it work?
Simple - we reuse the official binaries and add our modifications in via our patching process.
This method means we do not have to update our logic to match the new updated Terraria code, and so we can focus on adjusting our modifications (e.g. tiles, hooks, performance improvements) should they detect an abnormality.
Who is this intended for?
This is primarily intended for developers who want to create their own client or server modifications (just like TShock), as well as server administrators and GSPs who want to run the vanilla server with the ability to have better memory usage.
Want to help?
Simply head on over to TShock and join the Discord chat to get in the loop. A number of the developers here are familiar with the project and can help you.
Upcoming in version 3.0 (for developers)
This version of the OTAPI introduces a couple cool new features.
This version of the OTAPI introduces a couple cool new features.
- The first being a pattern based query mechanism that you can use to find meta data (ie methods, fields etc).
- Secondly a new auto hook mechanism has been introduced
Code:
// hooks any method prefixed with "Send" in Terraria.NetMessage
// this generates a number of Pre/Post hooks in ModFramework.ModHooks.NetMessage
// which can be used in external API consumers
new Query("Terraria.NetMessage.Send*", _framework.CecilAssemblies)
.Run()
.Hook()
;
// hooking a single method
// this generates PreAddShop & PostAddShop hooks in ModFramework.ModHooks.Chest
// which can be used in external API consumers
new Query("Terraria.Chest.AddShop(Terraria.Item)", _framework.CecilAssemblies)
.Run()
.Hook()
;
Last edited: