tModLoader Modding Tutorial 1: Basics

This is Many

Retinazer
Introduction
Hey guys! Have you ever wanted to create mods? If yes (like me), this tutorial is for you!
We will make mods for version 1.4.4 of Terraria.
Let's get down to business!

What are we going to study in this tutorial:
- How to go in modding
- How to create mod skeleton
- What is in the sources of the mod and how to use that


How to go in modding
First, you should know C#. Terraria is written on it and, accordingly, mod for it must also be written on it too.
I didn't know C# in my early days in modding, so I was very unprogressive.
Second, you need tModLoader. You can download it here.
Third, you can install a programming environment like Visual Studio (download).
Of course, you can work in notepad, but it is very inconvenient and there, unlike the Visual Studio,
it is impossible to use the .csproj file, with the help of which Visual Studio will be able to detect errors and know the entire Terraria library (like all item IDs).

How to create mod skeleton
1. Run tModLoader and click Workshop
1683220872665.png

2. Click Develop Mods and then click Create Mod
1683220963874.png

1683221081853.png

3. Fill in these fields
- Mod name in code (eg. MyMod)
- Mod public name (eg. My First Mod)
- Mod Author(s) (eg. This is Many)
- Mod's first item. It will be sword. We will see it in the next tutorial!
1683221224392.png

4. Click Open Sources
1683221530490.png

Now you can develop your mod!

What is in the sources of the mod and how to use that

Your mod sources will be look like that (yes, I'm on mac):
1683221820519.png

Let's take a look at each file in order!

build.txt
It contains information about the mod - its name, author, version, homepage etc. You can customise it, o' course!
Default stats:

displayName = My First Mod (the name of the mod)
author = This is Many (author of the mod)
version = 0.1 (mod version)

Additional Stats:
homepage = https://discord.gg/Z5v6JX6gEH (the main page of the mod, maybe discord server etc.)
hideCode = true/false (hide the mod's code of extracting?)
hideResources = true/false (hide the mod's .png files of extracting?)
includeSource = true/false (include mod sources on extracting?)
buildIgnore = *.csproj, *.user, obj\*, bin\*, .vs\*, Old\*, Other\* (files that you don't want to built in mod)


description.txt
The mod description. Nothing special except something:
[i/s1:981]
You can place that in your description to do item sprites in it! just replace 981 with ID of item you want to see!
1683223009797.png


icon.png

Mod icon in game. You will already have the frame for it in mod folder (
1683223184928.png
), but you can create your own!

Also there are 3 types of icons:
- icon is a default icon in game. Must be 80x80 pixels.
- icon_workshop is optional and it is an icon in steam workshop. Must be 512x512 pixels.
- icon_small is a bestiary filter of your mod. Must be 30x30 pixels.

MyMod.cs

This is a mod main file, like Main.cs in Terraria code. Can contain many things, we will learn about them in next tutorials!

MyMod.csproj

Used by Visual Studio to able it finding errors and know entire Terraria library.

Properties
Properties are used mainly for organization like specifing where will the sprites from weapons be searched for (leave blank and it will search the .png file with the same name as namespace's in folder where namespace directs)

Items
Yes, creating mod. This folder will contain all your mod items.
I would suggest creating a new folder named Content and putting it there, it will be much cleaner than just throwing it all around in the mod folder.
We will learn basic sword in the next tutorial


Ending
Thanks to everyone who read this tutorial to the end. I hope it will help many beginners in modding. I worked really hard on this tutorial, and I will be happy to see your feedback. Any questions allowed in comments! See you on the next tutorial!
Git Gud

Previous Tutorial / Next Tutorial
 
Last edited:
I’m saving up for a computer, and I already know some Minecraft modding. I also code, but I am still a beginner, because there isn’t much coding you can do on a tablet. I HAVE mastered a coding website for kids… but that’s a kids website. I can code games like mario on there… but that’s the furthest you can go. You can do 3D stuff, but then you have to code the RENDERING. So I just said “I’ll pass.” I’m working on a Mario-style game based off the website & it’s mascot, but it’s not done.
 
I’m saving up for a computer, and I already know some Minecraft modding. I also code, but I am still a beginner, because there isn’t much coding you can do on a tablet. I HAVE mastered a coding website for kids… but that’s a kids website. I can code games like mario on there… but that’s the furthest you can go. You can do 3D stuff, but then you have to code the RENDERING. So I just said “I’ll pass.” I’m working on a Mario-style game based off the website & it’s mascot, but it’s not done.
So, what do you mean?
 
okay, got it. then, download the pirate version (sorry ReLogic)
Please do not advise people to pirate the game.


This is the last and only warning you will get for doing this.
 
Please do not advise people to pirate the game.


This is the last and only warning you will get for doing this.
got it
 
Is it possible to make a mod, without TML? I want to get it soon, but I want to start modding already. Can resource packs combine with mods? Can mods change world Generation? Do mods apply to all worlds? Same with resource packs? If not, do worlds have to be created with the mod active, or can you add it in the middle of the playthrough?
 
Last edited:
Is it possible to make a mod, without TML?
I don't know how, but it possible (find what is tAPI)
Can resource packs combine with mods?
O' course
Can mods change world Generation?
Yes
Do mods apply to all worlds? Same with resource packs?
When enabled yes. And about resource packs, they just changing existing texture, but mod adds new content.
If not, do worlds have to be created with the mod active, or can you add it in the middle of the playthrough?
No, most of worldgen from mods applies only on world creation
 
Back
Top Bottom