Getting started with tModLoader
Last update: 9th of July, 2017
Table of contents
My tutorials
WIP
Other noteworthy tutorials and guides
Please note that these tutorials may or may not be more advanced than mine. Most of these will be more of more intermediate difficulty and will often require more extensive understanding of c# and knowledge of the API.
Prerequisites
Make sure you have....
Back to top
Introduction
In this tutorial I will cover how to get the basic template for a tModLoader mod, and getting to know various things about the API as well.
The tModLoader is an API (Application Programming Interface), quite literally a mod to make mods. It functions as a gateway between your mod and Terraria, and allows you to do many things with mostly indirect control, but managed. First and foremost, I'd like to cover a handful incredibly useful sites:
Back to top
I'm coming with tAPI/tConfig experience, what do I need to know?
Honestly, probably not much. tModLoader can be quite different in a lot of ways. Certain things are definitely similar though, such as things like ModItem, ModBuff etc. One thing you should know is that tML does not use JSON files (as handled previously) Furthermore, most communication is handled through our Discord server and Yorai/Skiphs are available there as well for more intermediate questions.
Back to top
Getting started
To get started, you're going to need a so called: 'mod skeleton' These are simply the base files you will need to get started. It is recommended to use jopo's 'mod skeleton generator' which does most work for you, so let's go ahaid and do that.
The generator is located here: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
You will be greeted by a few textboxes, fill these in and hit the generate button. It is common to end your mod name with 'Mod' so for example if I'm considering "Jofairden's Mod" I should name it "JofairdensMod", you should delete all special characters.
Noteworthy: you should never use whitespaces for most of this stuff (as these are internal names), either don't use spaces at all or use hyphens. E.g. My Super Sword becomes MySuperSword or My_Super_Sword. The latter is considered ugly by most developers, so going with the former is your safest bet and the most common convention in mods. Also note that if you have installed Terraria in a different location (not in C:\ for example), the reference to Terraria.exe will be broken and you'll need to add it manually.
Upon downloading, you will find that it has generated a .zip file for you. You will need an application such as 7zip to unpack this, Windows 10 can also unpack natively, however. Within this .zip file lies your mod source. Unzip the zip to the Terraria 'Mod Sources' (the WHOLE folder, not the contents only) The location for this place is as follows:
Upon first inspection you will find multiple files, and a folder. Amongst these files resides a .csproj file, this is your 'c-sharp' project file. Open this file. You will need Visual Studio for this. We will look at all the files in just a bit, first let's take a look at the main entry point of your mod: your mod class.
Back to top
The Mod class
To open the previously mentioned file, navigate to your Solution Explorer and open <ModName>.cs (E.g. mine would be JofairdensMod.cs)
Noteworthy: it is common convention to name the file after your classname
Your file should look something like this:
For newcomers, here is a neat image (by jopojelly) to quickly show the general structure of a c-sharp file. Note the .cs file extension, this stands for c-sharp (the programming language)
This is your 'Mod' class, notice how it derives from the 'Mod' class which lies within tML. Your mod project should have only one 'Mod' class.
More information about class inheritance and derived classes can be found here. In general, deriving from 'Mod' allows tML to pick up on your mod, and allows you (`the modder`) to access various methods to work with. (these are often called 'hooks') You will later notice that almost all of your classes for your mod will derive from some class that lies within tML.
Your mod skeleton has only one method, in this case it's actually not really a method (but it certainly looks like one)
The method you see is actually your class constructor, it is called when a new instance of your class is created. In this case, we can change various properties of our mod in it, which will then be set when tML creates a new instance of your mod. More information about class constructors can be found here. In the generated skeleton, various 'Autoload' properties are set to true. It is recommended to keep Autoloading on, as it saves you from writing a lot of unnecessary code.
Next, we're going to look at another file in your mod's root directory: build.txt
Back to top
The build.txt file
So, what is this build file for? The build file contains various other information about your mod, for when it gets built to a .tmod by tML. Your generated build file should look something like this:
I think the build file is pretty self explanatory, as it follows .ini (initialization) file format, In general all you do is follow the rule of: property = value
More information about the build file and its various properties can be found here.
Noteworthy: it's common convention to follow the following version format: <major>.<minor>.<build>.<revision>
In fact, the build file won't even allow for much other format, so go along with it I'd say. You should almost never increment your major version number, in fact tML is not even on major release 1 itself. You can also look at Terraria itself for example: the initial release was 1.0.0.0, right now we have only hit 1.3, many years after initial release!
Back to top
The description.txt file
This file is also pretty self explanatory. The information in this file will be used when you publish your mod to the mod browser.
Back to top
Let's continue: our first item
Now that we've covered the files in our root directory, let's have a look at that 'Items' directory. This directory is however, not so different from our root directory. In this case, it contains a .cs file for our sword and a sprite that goes along with it. Please note that the sprite and .cs file are in the same directory and share the same filename, this is very important when autoloading! This is because tML will look for the item's sprite in that same directory, using the same name. The directory tML will look for is dictated by the namespace your class is in (notice how the sword's namespace goes along with the directory path: namespace JofairdensMod.Items in path JofairdensMod/Items) Also note that sprites should always be in .PNG format. Even animated sprites, which use .png spritesheets (and not .gifs) More on this at a later stage.
You can open the sword file the same way you did for your mod file. You will notice, there's quite a bit more code to this than our skeleton mod class. Your code should look similar to the following:
Notice that there are 3 methods going on. Let's go over them and see what they do.
Just recently, SetDefaults got separated with SetStaticDefaults, and this new method was introduced together with language support for mods. Most 'static' stuff (that is not directly tied to the item object) will go in this method, such as setting the displayed name and tooltip(s). In my example, I want my sword to show as "Jofairden's Sword" and not as "JofairdensSword", so let's go ahaid and change that:
I will also program this sword to kill anything it hits, so I will change the tooltip to reflect this:
Next, we will look at the 'regular' SetDefaults() method. Here we can set various properties related to the item object, such as the damage and knockback. You can change these properties to your liking, and there are more properties available than you will see in the generated skeleton. This is the part where you'll want to have Visual Studio, as it contains 'Intellisense' which will show you all the properties available on the item object.
For my sword, I'm going to define custom behaviour, so let's set the damage to 1 and the knockback to nothing for the sake of exampleness:
To remove the knockback, I can set it to 0, but I can also simply omit the line of setting it, as the default knockback is always 0.
Notice that the knockback is a float and not an integer, meaning floating numbers are possible, such as 6.5f knockback. Also notice how the type is denoted by appending the 'f' after the number, e.g: item.knockback = 6.5f (also note that simply noting 6.5 will result in an error, as this is a double and not a float (which can also be denoted by appending a 'd' after the number))
It is very important that you understand the various different built-in data types in c-sharp, more information on this is available here.
The last method is AddRecipes(), in which we can create new recipes for our sword. Of course, we could create any kind of recipe we want here. But restraining the recipes created to the actual item itself is good in terms of code organization. The generated code should look something like this:
This code creates a new ModRecipe object, with our mod as the source of the recipe. Note that 'mod' (in new ModRecipe(mod)) is simply a mod object (of our mod) available in the current scope. Not all times is this object available, more on this in the tips section.
Next, we add 'DirtBlock' (a block of dirt) as a required ingredient, with the requirement of having at least 10 (`ten`). Note that the value passed here for the item is an integer, an item type or `ID` if you will. Almost all vanilla item types can be found in the Terraria.ID.ItemID namespace. Since the Terraria.ID namespace is included at the top of our file, we can simply call the ItemID class as shown. There are various ways to require modded items as an ingredient, more on this at a later stage.
Next, we add 'WorkBenches' as a required tile. This means the player will need to stand at any workbench for the recipe to be available. This TileID class comes from the same namespace as `ItemID`, so from the Terraria.ID namespace.
Next, we set the result to 'this', which is a reference to our current class, our 'ModItem' in this case. At the end, we call the method AddRecipe() on the ModRecipe object to add the recipe to the game. Note that if you want to create another recipe for the sword (say, with some other ingredients), you can reuse the same object and simply construct a new ModRecipe instance:
More on recipes in a later tutorial.
Back to top
What next?
Right now you have the barebones set up for your mod. If you go in-game and try to build the mod, it should work.
What do I need to know about 'Mods' and 'Mod Sources' in the in-game menu?
'Mods' refers to your 'Mods' folder in your documents. This is where all of your .tmod files are located. These files are the required files for you to be able to play mods. You either get them from creating your own mod(s), or by downloading others.
Let's take a look at the 'Mods' section. This section holds all .tmod files (mods) you have downloaded. (or your own built mods)
Right under the mod's name, it'll either say 'Disabled' or 'Enabled. Disabled mods will not be part of your Terraria.
If you want to enable a mod, either click 'Click to enable' or click 'Enable All'.
Make sure to click 'Reload mods' when you've changed enabled/disabled statuses.
The 'More info' button shows an information tab about the mod.
'Mod Sources' refers to your 'Mod Sources ' folder in your documents. This is where all your source files for your mods are located, which for me would be 'JofairdensMod'. In this menu you see several buttons, showcased in the following image.
WIP
Back to top
Tips
Always have an instance of your mod available
As I said earlier, sometimes you will have a 'mod' object available but not always. You can make your own mod instance object so you always have access to your mod instance for these scenarios. This can be done as follows:
Now you can access <YourMod>.instance (e.g. JofairdensMod.instance) when the mod object is not available.
Back to top
Notes
WIP
Back to top
Last update: 9th of July, 2017

Table of contents
- Table of contents
- My tutorials
- Other noteworthy tutorials and guides
- Prerequisites
- Introduction
- I'm coming with tAPI/tConfig experience, what do I need to know?
- Getting started
- The Mod class
- The build.txt file
- The description.txt file
- Let's continue: our first item
- What next?
- Tips
- Notes

My tutorials
WIP
- Getting Started with tModLoader
- Recipes
- Items
- Projectiles
Other noteworthy tutorials and guides
Please note that these tutorials may or may not be more advanced than mine. Most of these will be more of more intermediate difficulty and will often require more extensive understanding of c# and knowledge of the API.
- Projectile Guide and Implementation (by @Sin Costan)
- Custom Bosses - NPC AI and Server Syncing (by @blushiemagic) (note: this tutorial was written for tAPI)
- Creating Simple UI: Custom Resource Bars (by @Subaro)

Prerequisites
Make sure you have....
- ...the latest tModLoader release installed
- ...the latest Microsoft .NET Framework installed
- ...the Microsoft XNA Framework Redistributable 4.0 installed (you have this if you are able to play Terraria)
- ...Microsoft Visual Studio (community = free) installed with the C# workspace
- ...at least some basic understanding of C# (c-sharp)
Back to top

Introduction
In this tutorial I will cover how to get the basic template for a tModLoader mod, and getting to know various things about the API as well.
The tModLoader is an API (Application Programming Interface), quite literally a mod to make mods. It functions as a gateway between your mod and Terraria, and allows you to do many things with mostly indirect control, but managed. First and foremost, I'd like to cover a handful incredibly useful sites:
This site contains lots of useful information, including guides, references and links to open-source mods you can learn from.
This site contains documentation of the API source, generated by Doxygen. The docs are maintained through the source-code, meaning they are always up-to-date.
Even though this site is out-of-date, it still contains some useful (and applicable) information to date. This site should be approached with caution and information should be taken with a grain of salt due to its age.
ExampleMod is a mod that contains various code to 'showcase' what tModLoader is capable of. Please note that most of these are very blunt examples, they should be considered a base reference but nothing more.
There's also the old tAPI docs, but they're practically useless at this point.
Now, let's get to it already. Please note I like to write out things, a lot. If you're not about text, it might be better to watch a video guide instead.There's also the old tAPI docs, but they're practically useless at this point.
Back to top

I'm coming with tAPI/tConfig experience, what do I need to know?
Honestly, probably not much. tModLoader can be quite different in a lot of ways. Certain things are definitely similar though, such as things like ModItem, ModBuff etc. One thing you should know is that tML does not use JSON files (as handled previously) Furthermore, most communication is handled through our Discord server and Yorai/Skiphs are available there as well for more intermediate questions.
Back to top

Getting started
To get started, you're going to need a so called: 'mod skeleton' These are simply the base files you will need to get started. It is recommended to use jopo's 'mod skeleton generator' which does most work for you, so let's go ahaid and do that.
The generator is located here: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
You will be greeted by a few textboxes, fill these in and hit the generate button. It is common to end your mod name with 'Mod' so for example if I'm considering "Jofairden's Mod" I should name it "JofairdensMod", you should delete all special characters.
Noteworthy: you should never use whitespaces for most of this stuff (as these are internal names), either don't use spaces at all or use hyphens. E.g. My Super Sword becomes MySuperSword or My_Super_Sword. The latter is considered ugly by most developers, so going with the former is your safest bet and the most common convention in mods. Also note that if you have installed Terraria in a different location (not in C:\ for example), the reference to Terraria.exe will be broken and you'll need to add it manually.
Upon downloading, you will find that it has generated a .zip file for you. You will need an application such as 7zip to unpack this, Windows 10 can also unpack natively, however. Within this .zip file lies your mod source. Unzip the zip to the Terraria 'Mod Sources' (the WHOLE folder, not the contents only) The location for this place is as follows:
- Mac: /Users/account/Library/Application Support/Terraria/ModLoader/Mod Sources
- Linux: ~/.local/share/Terraria/ModLoader/Mod Sources OR $XDG_DATA_HOME/Terraria/ModLoader/Mod Sources
- Windows: %UserProfile%/Documents/My Games/Terraria/ModLoader/Mod Sources
Upon first inspection you will find multiple files, and a folder. Amongst these files resides a .csproj file, this is your 'c-sharp' project file. Open this file. You will need Visual Studio for this. We will look at all the files in just a bit, first let's take a look at the main entry point of your mod: your mod class.
Back to top

The Mod class
To open the previously mentioned file, navigate to your Solution Explorer and open <ModName>.cs (E.g. mine would be JofairdensMod.cs)
Noteworthy: it is common convention to name the file after your classname
Your file should look something like this:
Code:
using Terraria.ModLoader;
namespace JofairdensMod
{
class JofairdensMod : Mod
{
public JofairdensMod()
{
Properties = new ModProperties()
{
Autoload = true,
AutoloadGores = true,
AutoloadSounds = true
};
}
}
}
This is your 'Mod' class, notice how it derives from the 'Mod' class which lies within tML. Your mod project should have only one 'Mod' class.
More information about class inheritance and derived classes can be found here. In general, deriving from 'Mod' allows tML to pick up on your mod, and allows you (`the modder`) to access various methods to work with. (these are often called 'hooks') You will later notice that almost all of your classes for your mod will derive from some class that lies within tML.
Your mod skeleton has only one method, in this case it's actually not really a method (but it certainly looks like one)
The method you see is actually your class constructor, it is called when a new instance of your class is created. In this case, we can change various properties of our mod in it, which will then be set when tML creates a new instance of your mod. More information about class constructors can be found here. In the generated skeleton, various 'Autoload' properties are set to true. It is recommended to keep Autoloading on, as it saves you from writing a lot of unnecessary code.
Next, we're going to look at another file in your mod's root directory: build.txt
Back to top

The build.txt file
So, what is this build file for? The build file contains various other information about your mod, for when it gets built to a .tmod by tML. Your generated build file should look something like this:
Code:
author = Jofairden
version = 0.1
displayName = JofairdensMod
More information about the build file and its various properties can be found here.
Noteworthy: it's common convention to follow the following version format: <major>.<minor>.<build>.<revision>
In fact, the build file won't even allow for much other format, so go along with it I'd say. You should almost never increment your major version number, in fact tML is not even on major release 1 itself. You can also look at Terraria itself for example: the initial release was 1.0.0.0, right now we have only hit 1.3, many years after initial release!
Back to top

The description.txt file
This file is also pretty self explanatory. The information in this file will be used when you publish your mod to the mod browser.
Back to top

Let's continue: our first item
Now that we've covered the files in our root directory, let's have a look at that 'Items' directory. This directory is however, not so different from our root directory. In this case, it contains a .cs file for our sword and a sprite that goes along with it. Please note that the sprite and .cs file are in the same directory and share the same filename, this is very important when autoloading! This is because tML will look for the item's sprite in that same directory, using the same name. The directory tML will look for is dictated by the namespace your class is in (notice how the sword's namespace goes along with the directory path: namespace JofairdensMod.Items in path JofairdensMod/Items) Also note that sprites should always be in .PNG format. Even animated sprites, which use .png spritesheets (and not .gifs) More on this at a later stage.
You can open the sword file the same way you did for your mod file. You will notice, there's quite a bit more code to this than our skeleton mod class. Your code should look similar to the following:
Code:
using Terraria.ID;
using Terraria.ModLoader;
namespace JofairdensMod.Items
{
public class JofairdensSword : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("JofairdensSword");
Tooltip.SetDefault("This is a modded sword.");
}
public override void SetDefaults()
{
item.damage = 50;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Just recently, SetDefaults got separated with SetStaticDefaults, and this new method was introduced together with language support for mods. Most 'static' stuff (that is not directly tied to the item object) will go in this method, such as setting the displayed name and tooltip(s). In my example, I want my sword to show as "Jofairden's Sword" and not as "JofairdensSword", so let's go ahaid and change that:
Code:
DisplayName.SetDefault("Jofairden's Sword");
Code:
Tooltip.SetDefault("This sword kills anything it hits");
Next, we will look at the 'regular' SetDefaults() method. Here we can set various properties related to the item object, such as the damage and knockback. You can change these properties to your liking, and there are more properties available than you will see in the generated skeleton. This is the part where you'll want to have Visual Studio, as it contains 'Intellisense' which will show you all the properties available on the item object.
For my sword, I'm going to define custom behaviour, so let's set the damage to 1 and the knockback to nothing for the sake of exampleness:
Code:
item.damage = 1;
Notice that the knockback is a float and not an integer, meaning floating numbers are possible, such as 6.5f knockback. Also notice how the type is denoted by appending the 'f' after the number, e.g: item.knockback = 6.5f (also note that simply noting 6.5 will result in an error, as this is a double and not a float (which can also be denoted by appending a 'd' after the number))
It is very important that you understand the various different built-in data types in c-sharp, more information on this is available here.
The last method is AddRecipes(), in which we can create new recipes for our sword. Of course, we could create any kind of recipe we want here. But restraining the recipes created to the actual item itself is good in terms of code organization. The generated code should look something like this:
Code:
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
Next, we add 'DirtBlock' (a block of dirt) as a required ingredient, with the requirement of having at least 10 (`ten`). Note that the value passed here for the item is an integer, an item type or `ID` if you will. Almost all vanilla item types can be found in the Terraria.ID.ItemID namespace. Since the Terraria.ID namespace is included at the top of our file, we can simply call the ItemID class as shown. There are various ways to require modded items as an ingredient, more on this at a later stage.
Next, we add 'WorkBenches' as a required tile. This means the player will need to stand at any workbench for the recipe to be available. This TileID class comes from the same namespace as `ItemID`, so from the Terraria.ID namespace.
Next, we set the result to 'this', which is a reference to our current class, our 'ModItem' in this case. At the end, we call the method AddRecipe() on the ModRecipe object to add the recipe to the game. Note that if you want to create another recipe for the sword (say, with some other ingredients), you can reuse the same object and simply construct a new ModRecipe instance:
Code:
recipe = new ModRecipe(mod); // Same object, new instance
recipe.AddIngredient(Some other ingredient);
recipe.SetResult(this);
recipe.AddRecipe();
More on recipes in a later tutorial.
Back to top

What next?
Right now you have the barebones set up for your mod. If you go in-game and try to build the mod, it should work.
What do I need to know about 'Mods' and 'Mod Sources' in the in-game menu?
'Mods' refers to your 'Mods' folder in your documents. This is where all of your .tmod files are located. These files are the required files for you to be able to play mods. You either get them from creating your own mod(s), or by downloading others.
Let's take a look at the 'Mods' section. This section holds all .tmod files (mods) you have downloaded. (or your own built mods)

If you want to enable a mod, either click 'Click to enable' or click 'Enable All'.
Make sure to click 'Reload mods' when you've changed enabled/disabled statuses.
The 'More info' button shows an information tab about the mod.
'Mod Sources' refers to your 'Mod Sources ' folder in your documents. This is where all your source files for your mods are located, which for me would be 'JofairdensMod'. In this menu you see several buttons, showcased in the following image.

- The 'Build' button button under a Mod's name will then proceed to build the mod into a .tmod file. You shouldn't get any errors if everything in your source-code (src) is correct.
- The 'Build + Reload' button does the exact same thing, but also reloads all your mods. Reloading basically implements all your enabled mods in the 'Mods' section into Terraria.
- The 'Publish' button allows you to publish your mod to the mod browser, more on that later.
- The buttons below all your mod sources should speak for themselves, manage published is for 'managing' mods you've published on the mod browser.
- The Mod Browser allows you to browse and easily download mods that are published on there. The browser should be self explanatory.
WIP
Back to top

Tips
Always have an instance of your mod available
As I said earlier, sometimes you will have a 'mod' object available but not always. You can make your own mod instance object so you always have access to your mod instance for these scenarios. This can be done as follows:
- Declare a new static object for your instance (in your mod class)
Code:
public static JofairdensMod instance;
- Next, override the Load() hook and set your object instance here
Code:
public override void Load()
{
instance = this;
}
Now you can access <YourMod>.instance (e.g. JofairdensMod.instance) when the mod object is not available.
Back to top

Notes
WIP
Back to top
Last edited:
Scourge of light
Terrarian
What do I do if I get this
You fully install tML, which you didn't. One of the files can't be foundWhat do I do if I get thisView attachment 133787
Scourge of light
Terrarian
what should I do
reinstall it?
reinstall it?
Kitten9997
Terrarian
Scourge of light, I had the same error. I found out it was because my antivirus wrongly detected tModLoaderMac.exe as malicious software. You might need to add the terraria steam folder (or whereever terraria is installed) to the exceptions for your antivirus. That fixed the problem with me, and the antivirus stopped trying to delete tModLoaderMac.exe
Spiked Penguin
Terrarian
Well, so much for my idea lmao. Great job explaining and I have over looked some of your other guides very well done.
Find the Steamworks.NET.dll file in your Terraria Steam folder and delete it.Err....
Danstr
Terrarian
Really? Can I ask Why? (I'm a Noob LOL)Find the Steamworks.NET.dll file in your Terraria Steam folder and delete it.
Essentially because you have two of those, and the program doesn't know which one to use.Really? Can I ask Why? (I'm a Noob LOL)
Danstr
Terrarian
Essentially because you have two of those, and the program doesn't know which one to use.
Ah, well that makes sense. Thanks!
baileydog41
Terrarian
Guys pls help I got tmod loader and I installed a mod that whenever I open Terraria with mods it crashes, so I cant acess the mod folder to delete the mod, HOW DO I GET TO MY MODS FOLDER ON MAC WITHOUT GOING THROUGH ON TERRARIA!! Pls Help
Little_Luna
Terrarian
Okay First what kind of computer do you use? (Mac,linux,PC,etc.)Guys pls help I got tmod loader and I installed a mod that whenever I open Terraria with mods it crashes, so I cant acess the mod folder to delete the mod, HOW DO I GET TO MY MODS FOLDER ON MAC WITHOUT GOING THROUGH ON TERRARIA!! Pls Help
SnowLeopard Games
Terrarian
Guys pls help I got tmod loader and I installed a mod that whenever I open Terraria with mods it crashes, so I cant acess the mod folder to delete the mod, HOW DO I GET TO MY MODS FOLDER ON MAC WITHOUT GOING THROUGH ON TERRARIA!! Pls Help
on mac there is a bar at the top of the screen that has the name of the applications and some other text E.G: window, file, edit, etc.
click on finder and click go then hold option/alt and a file called library will appear click that and then click Application Support next scroll down and find the Terraria folder DO NOT GO INTO STEAM next click ModLoader and then go into mods and delete the mod that is stuffing your game up.
[doublepost=1488023122,1488023076][/doublepost]
*facepalm read the post againOkay First what kind of computer do you use? (Mac,linux,PC,etc.)
Piggy0007
Terrarian
I got this..
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1514: { expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1514: { expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1519: Invalid token ''\u0073'' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1519: Invalid token ''\u0073'' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(9,15) : error CS1519: Invalid token '=' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(9,21) : error CS1520: Method must have a return type
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(14,5) : error CS1597: Semicolon after method or accessor block is not valid
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(17,1) : error CS1022: Type or namespace definition, or end-of-file expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1514: { expected
And this http://images.akamai.steamuserconte...847/C7777D8E63AF80A32537869C0D2A3B4D5990243A/
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1514: { expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1514: { expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1519: Invalid token ''\u0073'' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1519: Invalid token ''\u0073'' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(9,15) : error CS1519: Invalid token '=' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(9,21) : error CS1520: Method must have a return type
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(14,5) : error CS1597: Semicolon after method or accessor block is not valid
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(17,1) : error CS1022: Type or namespace definition, or end-of-file expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1514: { expected
And this http://images.akamai.steamuserconte...847/C7777D8E63AF80A32537869C0D2A3B4D5990243A/
You're going to need to show your code of Pigifier.cs before anyone can help, use hastebin.comI got this..
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(3,17) : error CS1514: { expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1514: { expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(5,14) : error CS1519: Invalid token ''\u0073'' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(7,16) : error CS1519: Invalid token ''\u0073'' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(9,15) : error CS1519: Invalid token '=' in class, struct, or interface member declaration
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(9,21) : error CS1520: Method must have a return type
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(14,5) : error CS1597: Semicolon after method or accessor block is not valid
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Piglet'sExpansion.cs(17,1) : error CS1022: Type or namespace definition, or end-of-file expected
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1010: Newline in constant
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1012: Too many characters in character literal
c:\Users\bhewett\Documents\My Games\Terraria\ModLoader\Mod Sources\Piglet'sExpansion\Items\Pigifier.cs(4,17) : error CS1514: { expected
And this http://images.akamai.steamuserconte...847/C7777D8E63AF80A32537869C0D2A3B4D5990243A/
Piggy0007
Terrarian
Thanks. Also, is this good?
author = Piggy0007
*Inside of Build*
version = 0.1
Items
*Inside of Items
Pigifier.cs Pigifier (Image)
*Outside of Items*
build
*Inside of Build*
version = 0.1
displayName = Piglet's Expansion
homepage = https://forums.terraria.org/index.php?members/piggy0007.67881/
hideCode = false
hideResources = false
includeSource = true
buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\*
includePDB = true[/QUOTE]
*Outside of build*
description
*Inside of description*
Piglet's Expansion, a WIP.
*Outside of description*
Piglet'sExpansion.cs
Piglet'sExpansion.csproj
Piglet'sExpansion.csproj.user
Last edited: 9 minutes ago
Never mind, i just fixed it by deleting the cs pigifier and cs Piglet's Expansion...
author = Piggy0007
*Inside of Build*
version = 0.1
Items
*Inside of Items
Pigifier.cs Pigifier (Image)
*Outside of Items*
build
*Inside of Build*
version = 0.1
displayName = Piglet's Expansion
homepage = https://forums.terraria.org/index.php?members/piggy0007.67881/
hideCode = false
hideResources = false
includeSource = true
buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\*
includePDB = true[/QUOTE]
*Outside of build*
description
*Inside of description*
Piglet's Expansion, a WIP.
*Outside of description*
Piglet'sExpansion.cs
Piglet'sExpansion.csproj
Piglet'sExpansion.csproj.user
Last edited: 9 minutes ago
[doublepost=1488922691,1488922371][/doublepost]WOWYou're going to need to show your code of Pigifier.cs before anyone can help, use hastebin.com
Never mind, i just fixed it by deleting the cs pigifier and cs Piglet's Expansion...
Fluffertop
Terrarian
[doublepost=1490575375,1490575218][/doublepost]I got an error that said: error CS1514: { expected. I DON'T KNOW WHAT IT MEANS. PLS HELP!!!Your first mod!
Last update: 8th of June, 2016
![]()
Table of contents:
1. Prerequisites
2. Introduction
3. How to get the skeleton of your first mod
4. What now?
![]()
Prerequisites
Make sure you have....
- ...the latest tModLoader installed (offical thread)
- ...the latest Microsoft .NET Framework installed (offical .net site)
- ...the Microsoft XNA Framework installed (you have this if you are able to play Terraria)
- ...Microsoft Visual Studio (community = free) installed with the C# workspace (official MVS site)
- .. actually, MVS isn't required but it's a very nice IDE to work with. You can also use notepad or notepadd++ or alike, but MVS will be super useful for noobs that makes simple mistakes because the IDE will help you program
- ...C# knowledge, all tML mods currently are programmed with the C# language
![]()
Introduction
In this tutorial I'm going to briefly explain how to get your first mod going!
![]()
How to get the skeleton of your first mod
- Go here: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
- Enter the required details. Do NOT use spaces for the mod name.
- Unzip the zip to the Terraria 'Mod Sources' (the WHOLE folder, not the contents only)
- Mac: /Users/account/Library/Application Support/Terraria/ModLoader/Mod Sources
- Linux: ~/.local/share/Terraria/ModLoader/Mod Sources OR $XDG_DATA_HOME/Terraria/ModLoader/Mod Sources
- Windows: %UserProfile%\Documents\My Games\Terraria\ModLoader\Mod Sources
- The build.txt is messed up, use the following (or latest from ExampleMod) and change to your needs:
Code:author = gorateron version = 0.1 displayName = My first mod homepage = http://forums.terraria.org/index.php?posts/998374 hideCode = false hideResources = false includeSource = true buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\* includePDB = true
- Start working on your mod!
- You can use the .csproj file to work using Microsoft Visual Studio
![]()
What now?
Right now you have the barebones set up for your mod. If you go in-game and try to build the mod, it should work.
Also, the generator should already have referenced Terraria.exe and the XNA files for you.
Don't forget to change build.txt
If for some reason the generator does not work, you can download a generated Mod Source named 'MyFirstMod' from the attachment.
If you plan on using it, remember to change all namespaces. Also don't forget to change build.txt to the example in the spoiler above.
What do I need to know about 'Mods' and 'Mod Sources' in the in-game menu?
'Mods' refers to your 'Mods' folder in your documents. This is where all of your .tmod files are located. These files are the required files for you to be able to play mods. You either get them from creating your own mod(s), or by downloading others.
Let's take a look at the 'Mods' section. This section holds all .tmod files (mods) you have downloaded.
Right under the mod's name, it'll either say 'Disabled' or 'Enabled. Disabled mods will not be part of your Terraria.![]()
If you want to enable a mod, either click 'Click to enable' or click 'Enable All'.
Make sure to click 'Reload mods' when you've changed enabled/disabled statuses.
The 'More info' button shows an information tab about the mod.
'Mod Sources' refers to your 'Mod Sources ' folder in your documents. This is where all your source files for your mods are located. In this menu you see several buttons, showcased in the following image.
![]()
The 'Build' button under a Mod's name will then proceed to build the mod into a .tmod file. You shouldn't get any errors if everything in your sourcecode (src) is correct.
The 'Build + Reload' does the exact same thing, but also reloads all your mods. Reloading basically implements all your enabled mods in the 'Mods' section into Terraria.
The 'Publish' allows you to publish your mod to the mod browser, more on that later.
The buttons below all your mod sources should speak for themselves.
The Mod Browser allows you to browse and easily download mods that are published on there. This browser should be self explanatory in full honesty.
Before you move on
I highly advise you to download ExampleMod at take a look at how things are globally done, as well as directory structure.
Also make sure you check out the following link, and briefly browse through some of the existing hooks: https://github.com/bluemagic123/tModLoader/wiki/
Go to next tutorial: Tutorial [2] Recipes
silverninja510
Terrarian
When I try to build the testmod I get this error
Any advice?
OverlordCMD
Skeletron Prime
I cant find mod sources.
Similar threads
- Replies
- 1
- Views
- 351
- Replies
- 39
- Views
- 21K
- Replies
- 0
- Views
- 1K
- Replies
- 0
- Views
- 546
-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.