Standalone [1.3] tModLoader - A Modding API

Hey, know I'm kinda late to this forum, but I was an idiot and decided to enable every single mod I have ever downloaded. It loads up to the point where it says Setting Up, then freezes and closes. Can anyone help me with this?
An easy way to deal with this is to hold Shift before it gets to the mod loading. It will then automatically not load in your mods, just tModLoader, so you'll be able to disable them from the mods menu. Generally, too many mods will overload Terraria due to its nature as a 32 bit program, and therefore its 4GB memory limit.
As has already been stated by others, you can also manually edit the enabled.json, or if you really want to, you can delete the .tmod files from your Mods folder to entirely uninstall them (usually Documents\My Games\Terraria\ModLoader\Mods, which if I recall, is also where enabled.json is located.)
 
What are the ways to create an explosion? I want to make my NPC explode on death or if it is set on fire (I would assume for the explode when set on fire thing I would do that in the AI).
 
What are the ways to create an explosion? I want to make my NPC explode on death or if it is set on fire (I would assume for the explode when set on fire thing I would do that in the AI).
You'd just create a short-lived projectile with some dust for the explosion effect
 
eRROR.PNG
Can somebody help me? everytime I click on Singleplayer in the main menu my game crashes with this message
[doublepost=1547365856,1547365819][/doublepost]the letters outside of the white box are because I used snipping tool to capture the white box with discord behind it
 
it varies, no matter what combination it still crashes with the exact same message, the least mods I used were 4, and only 1 of them added items in a count of only around 50 or less

Try running the game with no mods on, if that does not work remove tModLoader. If neither of those things work than there will be something wrong with Terraria entirely
 
Mod Development Guide for OSX/Linux
(or How to Build Your Mod Without Using tModLoader)
Introduction
Building a mod in a non-Windows operating system can be a bit difficult, since there is a lack of access to Visual Studio (on Linux; VS is now available for OSX, though none of the instructions below have changed) and tModLoader is unable to build the mod files itself. However, it is possible, and it's actually not all that hard. I will be using the Xamarin IDE (now replaced by VS on OSX, and MonoDevelop on Linux). Here's the steps:

1. Install Visual Studio (if on OSX) or Monodevelop (on Linux).
2. You're going to need a .csproj file. Copy the one from ExampleMod into your mod's root directory.
NOTE: All steps from 3 to 7 can be ignored if you use one of the pre-made .csproj XMLs in the attachments. Instructions on how to use them are included below.
3. Open the .csproj file in any text editor. You're gonna need to change a couple things. Specifically:
3a. Find the AssemblyName tag and change the value from "ExampleMod" to whatever your mod's name is (this is the name of the root folder).
3b. Go down to the end of the file and delete the line within the last PropertyGroup (the one that says "PostBuild" or whatever).
4. For convenience, rename this .csproj "Windows". Duplicate it and make another called "Mono".
5. Open the Windows.csproj in Xamarin, and expand the References "folder". Several Microsoft.Xna.* references and a Terraria reference should be missing.
6. Remove these references. Right-click on References and click Edit References. Go over to the .NET Assembly tab and click Browse. Now select all the .dll files and the .exe that came in the ModCompile folder of your non-Windows tModLoader download. Make sure the boxes of these new references are checked in the Edit References window, and click OK.
6b. If you aren't building ExampleMod, you'll probably notice many ExampleMod files that don't exist in your project. Go ahead and remove them at this time.
7. Do the same thing in the Mono .csproj file. However, this time, you're targeting different files: FNA.dll and a non-Windows tModLoader Terraria.exe. You can get these from either a non-Windows tModLoader Terraria installation or from the ModCompile folder in a Windows tModLoader download (the Terraria reference is tModLoaderMac.exe).
8. Build both .csproj files (click the 'Play' looking button on the top-left of the Xamarin window). I don't know if there's much of a difference between making a Debug and a Release build - for convenience, I just have Windows build as one type and Mono build as another.
9. If you've set everything up correctly, your mod builds should have succeeded. Go into the obj/release folder and the obj/debug folder. Take the ModName.dll files from each and rename them according to what built them (if you had Windows build to Debug, then rename the obj/debug file Windows.dll). Place these .dlls in the mod's root directory.
10. Open build.txt and add the line "noCompile = true" to the end of it.
11. Open Terraria and have tModLoader build your mod!
I hope this helps!

How to use the included .csproj files:
These files are pre-made .csproj files that have gone through the steps above and then some. TCF doesn't allow uploading files with the .csproj extension, so the .txt extension must be removed before use.
They should already have working sources, provided the .csproj is inside a folder in the Mod Sources directory. Sources are also set up to switch to the correct one depending on how you're building the project, so there's no need to have two separate projects for Mono and Windows builds.
The missing ReLogic dependencies ReLogic.dll and ReLogicLinux.dll can be downloaded from the tModLoader GitHub (found in the "references" folder) and placed into the ModCompile folder in your Terraria installation.

Additionally, they're already set up to automatically copy the built .dll files to the proper place when building, so you'll never have to manually move them yourself.
Build with both Mono and Windows settings to build both Mono.dll and Windows.dll!

_Blank files: These .csproj files don't contain any references to ExampleMod files and are perfect for starting a mod from scratch. They still contain build.txt and description.txt, which every mod should have anyway.
OSX/Linux files: Each version gets the sources from a slightly different location for the indicated operating system. Get the one that matches yours!

Don't forget that these files are still named ExampleMod both outside and inside, so be sure to change the assembly and root namespace name as you see fit!

A few notes:
-The mod's root folder must be located in Terraria/ModLoader/Mod Sources. You can access this folder from the Mod Sources option on the tModLoader main menu.
-If your mod is not referencing Microsoft.Xna.* in any way, then you don't need to do the double build: instead, just build one file and name it All.dll.
-tModLoader cannot build your mod if the AssemblyName does not match the name of the root folder.
-It's best to practice these steps by applying them to ExampleMod first, so that you know how it works. If you have issues building ExampleMod, check the steps again. If you're still having issues, contact me via Discord and I can put you in the right direction ;)
-Changing the RootNamespace option in your .csproj will change the default namespace that new .cs files are put into by the skeleton code.

-If you want your mod to be editable by non-Windows users, you can remove the exclusion of the .csproj file in build.txt. Others will then be able to open the .csproj after unpacking it with tModReader.

This is guide version 1.2. Changelog:
- 1.0: Initial release.
- 1.1: A bit more information, typo fixes.
- 1.2: More information, added template .csproj files
so, if i'm working with a pre-built csproj, do i just chuck it into a mod file? or do i remove the .txt then put it in?
 
Mod Development Guide for OSX/Linux
(or How to Build Your Mod Without Using tModLoader)
Introduction
Building a mod in a non-Windows operating system can be a bit difficult, since there is a lack of access to Visual Studio (on Linux; VS is now available for OSX, though none of the instructions below have changed) and tModLoader is unable to build the mod files itself. However, it is possible, and it's actually not all that hard. I will be using the Xamarin IDE (now replaced by VS on OSX, and MonoDevelop on Linux). Here's the steps:

1. Install Visual Studio (if on OSX) or Monodevelop (on Linux).
2. You're going to need a .csproj file. Copy the one from ExampleMod into your mod's root directory.
NOTE: All steps from 3 to 7 can be ignored if you use one of the pre-made .csproj XMLs in the attachments. Instructions on how to use them are included below.
3. Open the .csproj file in any text editor. You're gonna need to change a couple things. Specifically:
3a. Find the AssemblyName tag and change the value from "ExampleMod" to whatever your mod's name is (this is the name of the root folder).
3b. Go down to the end of the file and delete the line within the last PropertyGroup (the one that says "PostBuild" or whatever).
4. For convenience, rename this .csproj "Windows". Duplicate it and make another called "Mono".
5. Open the Windows.csproj in Xamarin, and expand the References "folder". Several Microsoft.Xna.* references and a Terraria reference should be missing.
6. Remove these references. Right-click on References and click Edit References. Go over to the .NET Assembly tab and click Browse. Now select all the .dll files and the .exe that came in the ModCompile folder of your non-Windows tModLoader download. Make sure the boxes of these new references are checked in the Edit References window, and click OK.
6b. If you aren't building ExampleMod, you'll probably notice many ExampleMod files that don't exist in your project. Go ahead and remove them at this time.
7. Do the same thing in the Mono .csproj file. However, this time, you're targeting different files: FNA.dll and a non-Windows tModLoader Terraria.exe. You can get these from either a non-Windows tModLoader Terraria installation or from the ModCompile folder in a Windows tModLoader download (the Terraria reference is tModLoaderMac.exe).
8. Build both .csproj files (click the 'Play' looking button on the top-left of the Xamarin window). I don't know if there's much of a difference between making a Debug and a Release build - for convenience, I just have Windows build as one type and Mono build as another.
9. If you've set everything up correctly, your mod builds should have succeeded. Go into the obj/release folder and the obj/debug folder. Take the ModName.dll files from each and rename them according to what built them (if you had Windows build to Debug, then rename the obj/debug file Windows.dll). Place these .dlls in the mod's root directory.
10. Open build.txt and add the line "noCompile = true" to the end of it.
11. Open Terraria and have tModLoader build your mod!
I hope this helps!

How to use the included .csproj files:
These files are pre-made .csproj files that have gone through the steps above and then some. TCF doesn't allow uploading files with the .csproj extension, so the .txt extension must be removed before use.
They should already have working sources, provided the .csproj is inside a folder in the Mod Sources directory. Sources are also set up to switch to the correct one depending on how you're building the project, so there's no need to have two separate projects for Mono and Windows builds.
The missing ReLogic dependencies ReLogic.dll and ReLogicLinux.dll can be downloaded from the tModLoader GitHub (found in the "references" folder) and placed into the ModCompile folder in your Terraria installation.

Additionally, they're already set up to automatically copy the built .dll files to the proper place when building, so you'll never have to manually move them yourself.
Build with both Mono and Windows settings to build both Mono.dll and Windows.dll!

_Blank files: These .csproj files don't contain any references to ExampleMod files and are perfect for starting a mod from scratch. They still contain build.txt and description.txt, which every mod should have anyway.
OSX/Linux files: Each version gets the sources from a slightly different location for the indicated operating system. Get the one that matches yours!

Don't forget that these files are still named ExampleMod both outside and inside, so be sure to change the assembly and root namespace name as you see fit!

A few notes:
-The mod's root folder must be located in Terraria/ModLoader/Mod Sources. You can access this folder from the Mod Sources option on the tModLoader main menu.
-If your mod is not referencing Microsoft.Xna.* in any way, then you don't need to do the double build: instead, just build one file and name it All.dll.
-tModLoader cannot build your mod if the AssemblyName does not match the name of the root folder.
-It's best to practice these steps by applying them to ExampleMod first, so that you know how it works. If you have issues building ExampleMod, check the steps again. If you're still having issues, contact me via Discord and I can put you in the right direction ;)
-Changing the RootNamespace option in your .csproj will change the default namespace that new .cs files are put into by the skeleton code.

-If you want your mod to be editable by non-Windows users, you can remove the exclusion of the .csproj file in build.txt. Others will then be able to open the .csproj after unpacking it with tModReader.

This is guide version 1.2. Changelog:
- 1.0: Initial release.
- 1.1: A bit more information, typo fixes.
- 1.2: More information, added template .csproj files
@thegamemaster1234 so, if i'm working with a pre-built csproj, do i just chuck it into a mod file or remove the .txt first?
 
Last edited:
Oh hey, just wanted to pop in and say gratz on 1000 pages!
I know it's kind of an arbitrary achievement but hey, just goes to show how big tModLoader has gotten.
I remember back in the day, of 1.2+ and early 1.3, I barely knew Terraria even had mods. I knew it had a few decently-large ones, but I had no idea just how robust the API was, how amazing the compatability was, and certainly not how active and inspired the modding community was.
Perhaps I just wasn't around early enough, but I feel like tModLoader has been a massive boon to Terraria modding as a whole, and has really caused a modding renaissance, with so many mods, and especially so many high quality and unique mods, small and large, compared to tAPI and all before it, with such an in-depth framework that I've not seen in any other unofficial (and in fact very few official) modding APIs, allowing so many mods that add so many things to work nearly seamlessly together, to install and manage from the game's menu, to be able to customize essentially every single aspect of the game, and beyond.

1000 pages of people talking about the mod. That's thousands upon thousands of posts. I just gotta say, I'm so ecstatic that the modding community for this game is so alive, even as the Vanilla game's development has slowed. I don't think any other game, aside from perhaps Bethesda's Singleplayer RPGs, has had such a wealth of modding that is able to make the game replayable again and again with hundreds of different setups that all feel unique and exciting. And it's always improving.

So, while I cannot speak for the community at large, I have to say, thank you, everyone on the tModLoader team, and all of you modders, veteran or aspiring, for keeping this wonderful game so relevant, so exciting and expanded, even during the slow-content periods, hopefully for many years to come! A few years ago I never would have thought of modding a game as content-rich as Terraria. These days, the thought of going back to Vanilla Terraria is almost unthinkable.
 
Oh hey, just wanted to pop in and say gratz on 1000 pages!
I know it's kind of an arbitrary achievement but hey, just goes to show how big tModLoader has gotten.
I remember back in the day, of 1.2+ and early 1.3, I barely knew Terraria even had mods. I knew it had a few decently-large ones, but I had no idea just how robust the API was, how amazing the compatability was, and certainly not how active and inspired the modding community was.
Perhaps I just wasn't around early enough, but I feel like tModLoader has been a massive boon to Terraria modding as a whole, and has really caused a modding renaissance, with so many mods, and especially so many high quality and unique mods, small and large, compared to tAPI and all before it, with such an in-depth framework that I've not seen in any other unofficial (and in fact very few official) modding APIs, allowing so many mods that add so many things to work nearly seamlessly together, to install and manage from the game's menu, to be able to customize essentially every single aspect of the game, and beyond.

1000 pages of people talking about the mod. That's thousands upon thousands of posts. I just gotta say, I'm so ecstatic that the modding community for this game is so alive, even as the Vanilla game's development has slowed. I don't think any other game, aside from perhaps Bethesda's Singleplayer RPGs, has had such a wealth of modding that is able to make the game replayable again and again with hundreds of different setups that all feel unique and exciting. And it's always improving.

So, while I cannot speak for the community at large, I have to say, thank you, everyone on the tModLoader team, and all of you modders, veteran or aspiring, for keeping this wonderful game so relevant, so exciting and expanded, even during the slow-content periods, hopefully for many years to come! A few years ago I never would have thought of modding a game as content-rich as Terraria. These days, the thought of going back to Vanilla Terraria is almost unthinkable.
Thank you.
 
Is the bug that unable me to reforge any modded weapon from the tmodloader itself? i already unabled all my mods one by one and tested it if it was a specific mod but i'm still not able to reforge modded weapon... i can reforge accessories tho
 
Back
Top Bottom