Standalone [1.3] tModLoader - A Modding API

I played tmodloader. I got an error after playing for a couple of minutes.
I had verison: v0.10.0.2
Terraria verison: 1.3.5.2

[doublepost=1498870959,1498870929][/doublepost]
I played tmodloader. I got an error after playing for a couple of minutes.
I had verison: v0.10.0.2
Terraria verison: 1.3.5.2
The error message is below.
[doublepost=1498870996][/doublepost]
I played tmodloader. I got an error after playing for a couple of minutes.
I had verison: v0.10.0.2
Terraria verison: 1.3.5.2

[doublepost=1498870959,1498870929][/doublepost]
The error message is below.
What can I do to fix this problem?
 

Attachments

  • Terraria_ Error 6_19_2017 3_41_27 PM.png
    Terraria_ Error 6_19_2017 3_41_27 PM.png
    34.4 KB · Views: 250
When i run the installer it says could not find place to install to. is this because i dont have terraria on my C: drive? If so, how do i direct it to where it is now?
 
Alright.. dunno if anyone else is having this issue, but: is anyone else having an issue where launching the latest version of tModloader causes the PC to softlock at a blackscreen? It has happened twice to me today since updating. The game has launched fine without any problem a few times today as well. Is it possible there's a bug causing this to happen in the latest version?
 
I played tmodloader. I got an error after playing for a couple of minutes.
I had verison: v0.10.0.2
Terraria verison: 1.3.5.2

[doublepost=1498870959,1498870929][/doublepost]
The error message is below.
[doublepost=1498870996][/doublepost]
What can I do to fix this problem?
GamehunterMC theres a button called "edit" it allows you to edit your comments without double posting your messages because you posted the same message twice and this creates more alerts.
 
When i run the installer it says could not find place to install to. is this because i dont have terraria on my C: drive? If so, how do i direct it to where it is now?
just manually drag and drop the files into where your terraria installation is if the installer doesnt work
 
Hello, i have a problem where i do not found fix.
When i loading a mod than i have build without error(after try to update to 0.10), Terraria crash without says nothing.

Visual studio say than this is System.NullReferenceException: "Object reference not set to an instance of an object."
Also, on my Visual Studio project, he do not found any errors or warnings for that.

Thank you for listen me.
 
Thank you! :D Btw, is there any guides on here about making and applying Debuffs to NPCs?
Edit: I meant Custom Debuffs, my bad.
I don't know where there are any tutorials, but you use the Update hook to do stuff to a NPC. An empty hook looks like this.
Code:
public override void Update(NPC npc, ref int buffIndex)
        {
            //do stuff to the NPC here
        }

Thx, I changed it to null but I am getting other errors.:
Here's the Compile Errors.txt:
Code:
c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(134,5) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(134,37) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(183,31) : warning CS0618: 'Terraria.Lang.chestType' ist veraltet: 'Lang arrays have been replaced with the new Language.GetText system.'

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\AutomaticChest.cs(183,31) : error CS0266: Der Typ 'Terraria.Localization.LocalizedText' kann nicht implizit in 'string' konvertiert werden. Es ist bereits eine explizite Konvertierung vorhanden. (Möglicherweise fehlt eine Umwandlung.)

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(128,5) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(128,37) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(177,31) : warning CS0618: 'Terraria.Lang.chestType' ist veraltet: 'Lang arrays have been replaced with the new Language.GetText system.'

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Tiles\EjectorChest.cs(177,31) : error CS0266: Der Typ 'Terraria.Localization.LocalizedText' kann nicht implizit in 'string' konvertiert werden. Es ist bereits eine explizite Konvertierung vorhanden. (Möglicherweise fehlt eine Umwandlung.)

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(63,7) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(63,42) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(82,7) : error CS1502: Die beste Übereinstimmung für die überladene 'Terraria.NetMessage.SendData(int, int, int, Terraria.Localization.NetworkText, int, float, float, float, int, int, int)'-Methode hat einige ungültige Argumente.

c:\Users\Johannes\Documents\My Games\Terraria\ModLoader\Mod Sources\Itemtronics-master\Util\ChestUtils.cs(82,42) : error CS1503: Argument '4': Konvertierung von 'string' in 'Terraria.Localization.NetworkText' nicht möglich.

and you already have the code ot the Automatic Chest.cs,
so here are the other files:
Ejector Chest.cs:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Itemtronics.Util;

namespace Itemtronics.Tiles
{
    public class EjectorChest : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSpelunker[Type] = true;
            Main.tileContainer[Type] = true;
            Main.tileShine2[Type] = true;
            Main.tileShine[Type] = 1200;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileValue[Type] = 5000;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
            TileObjectData.newTile.Origin = new Point16(0, 1);
            TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 };
            TileObjectData.newTile.HookCheck = new PlacementHook(Chest.FindEmptyChest, -1, 0, true);
            TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false);
            TileObjectData.newTile.AnchorInvalidTiles = new int[] { 127 };
            TileObjectData.newTile.StyleHorizontal = true;
            TileObjectData.newTile.LavaDeath = false;
            TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
            TileObjectData.addTile(Type);
            //AddMapEntry(new Color(200, 200, 200), "Ejector Chest", MapChestName);
            ModTranslation name = CreateMapEntryName();
            name.SetDefault("Ejector Chest");
            AddMapEntry(new Color(200, 200, 200),name);
            dustType = mod.DustType("Sparkle");
            disableSmartCursor = true;
            adjTiles = new int[] { TileID.Containers };
            chest = "Ejector Chest";
            chestDrop = mod.ItemType("EjectorChest");
        }

        public override void HitWire(int x, int y)
        {
            int chestID = ChestUtils.GetChestID(x, y);
            int ownerID = Main.netMode == 2 ? Chest.UsingChest(chestID) : -1;
            Chest chest = Main.chest[chestID];

            Wiring.SkipWire(chest.x, chest.y);
            Wiring.SkipWire(chest.x+1, chest.y);
            Wiring.SkipWire(chest.x, chest.y+1);
            Wiring.SkipWire(chest.x+1, chest.y+1);

            for (int i = 0; i < chest.item.Length; ++i)
            {
                if (chest.item[i].type != 0)
                {
                    Item.NewItem(chest.x * 16, chest.y * 16, 32, 32, chest.item[i].type, chest.item[i].stack, false, chest.item[i].prefix);
                    chest.item[i].SetDefaults(0, true);

                    if (ownerID != -1)
                    {
                        NetMessage.SendData(32, ownerID, -1, null, chestID, i, 0f, 0f, 0, 0, 0);
                    }

                    break;
                }
            }
        }

        public string MapChestName(string name, int i, int j)
        {
            string chestName = ChestUtils.GetChest(i, j).name;
            if (chestName == "")
            {
                return name;
            }
            else
            {
                return name + ": " + chestName;
            }
        }

        public override void NumDust(int i, int j, bool fail, ref int num)
        {
            num = 1;
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 32, 32, chestDrop);
            Chest.DestroyChest(i, j);
        }

        public override void RightClick(int i, int j)
        {
            Player player = Main.player[Main.myPlayer];
            Tile tile = Main.tile[i, j];
            Main.mouseRightRelease = false;
            int left = i;
            int top = j;
            if (tile.frameX != 0)
            {
                left--;
            }
            if (tile.frameY != 0)
            {
                top--;
            }

            if (player.sign >= 0)
            {
                Main.PlaySound(11, -1, -1, 1);
                player.sign = -1;
                Main.editSign = false;
                Main.npcChatText = "";
            }
            if (Main.editChest)
            {
                Main.PlaySound(12, -1, -1, 1);
                Main.editChest = false;
                Main.npcChatText = "";
            }
            if (player.editedChestName)
            {
                NetMessage.SendData(33, -1, -1, Main.chest[player.chest].name, player.chest, 1f, 0f, 0f, 0, 0, 0);
                player.editedChestName = false;
            }
            if (Main.netMode == 1)
            {
                if (left == player.chestX && top == player.chestY && player.chest >= 0)
                {
                    player.chest = -1;
                    Recipe.FindRecipes();
                    Main.PlaySound(11, -1, -1, 1);
                }
                else
                {
                    NetMessage.SendData(31, -1, -1, null, left, (float)top, 0f, 0f, 0, 0, 0);
                    Main.stackSplit = 600;
                }
            }
            else
            {
                int chest = Chest.FindChest(left, top);
                if (chest >= 0)
                {
                    Main.stackSplit = 600;
                    if (chest == player.chest)
                    {
                        player.chest = -1;
                        Main.PlaySound(11, -1, -1, 1);
                    }
                    else
                    {
                        player.chest = chest;
                        Main.playerInventory = true;
                        Main.recBigList = false;
                        player.chestX = left;
                        player.chestY = top;
                        Main.PlaySound(player.chest < 0 ? 10 : 12, -1, -1, 1);
                    }
                    Recipe.FindRecipes();
                }
            }
        }

        public override void MouseOver(int i, int j)
        {
            Player player = Main.player[Main.myPlayer];
            Chest chest = ChestUtils.GetChestSafe(i, j);
            player.showItemIcon2 = -1;
            if (chest == null)
            {
                player.showItemIconText = Lang.chestType[0];
            }
            else
            {
                player.showItemIconText = chest.name.Length > 0 ? chest.name : "Ejector Chest";
                if (player.showItemIconText == "Ejector Chest")
                {
                    player.showItemIcon2 = mod.ItemType("EjectorChest");
                    player.showItemIconText = "";
                }
            }
            player.noThrow = 2;
            player.showItemIcon = true;
        }

        public override void MouseOverFar(int i, int j)
        {
            MouseOver(i, j);
            Player player = Main.player[Main.myPlayer];
            if (player.showItemIconText == "")
            {
                player.showItemIcon = false;
                player.showItemIcon2 = 0;
            }
        }
    }
}

Item Translocator.cs:
Code:
using Itemtronics.Util;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace Itemtronics.Tiles
{
    class ItemTranslocator : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolid[Type] = true;
            Main.tileSolidTop[Type] = true;
            Main.tileFrameImportant[Type] = true;
            Main.tileLavaDeath[Type] = false;
            Main.tileValue[Type] = 1000;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1);
            TileObjectData.newTile.StyleHorizontal = true;
            TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0);
            TileObjectData.newTile.LavaDeath = false;
            TileObjectData.addTile(Type);
            //disableSmartCursor = true;
            drop = mod.ItemType("ItemTranslocator");
        }

        /*public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak)
        {
            Tile tile = Main.tile[i, j];
            tile.frameX = 36;
            //tile.frameY = 0;
            return true;
        }*/

        public override void RightClick(int i, int j)
        {
            Tile tile = Main.tile[i, j];
            tile.frameX = (short)((tile.frameX + 18) % 72);
        }

        public override void HitWire(int x, int y)
        {
            Tile tile = Main.tile[x, y];
            int ChestInID = ChestUtils.GetTargetChestID(x, y, tile.frameX / 18);
            int ChestOutID = ChestUtils.GetTargetChestID(x, y, (tile.frameX / 18 + 2) % 4);

            if (ChestInID != -1 && ChestOutID != -1)
            {
                Item[] ItemsIn = Main.chest[ChestInID].item;
                Item[] ItemsOut = Main.chest[ChestOutID].item;
                int OwnerInID = Main.netMode == 2 ? Chest.UsingChest(ChestInID) : -1;
                int OwnerOutID = Main.netMode == 2 ? Chest.UsingChest(ChestOutID) : -1;

                for (int i = 0; i < ItemsIn.Length; ++i)
                {
                    if (ItemsIn[i].type != 0)
                    {
                        ItemState state = ChestUtils.DepositItem(ChestOutID, OwnerOutID, ItemsOut, ItemsIn[i]);
                        if (state != ItemState.SAME)
                        {
                            if (state == ItemState.EMPTY)
                            {
                                ItemsIn[i] = new Item();
                            }
                            if (OwnerInID != -1)
                            {
                                NetMessage.SendData(32, OwnerInID, -1, null, ChestInID, i, 0f, 0f, 0, 0, 0);
                            }
                            break;
                        }
                    }
                }
            }
        }
    }
}

Chest Utils.cs:
Code:
using System;
using Terraria;
using Terraria.ObjectData;

namespace Itemtronics.Util
{
    internal enum ItemState
    {
        EMPTY,
        CHANGED,
        SAME
    }

    internal static class ChestUtils
    {
        public static readonly int[] xOffset = { 0, -1, 0, 1 };
        public static readonly int[] yOffset = { 1, 0, -1, 0 };

        public static Chest GetChest(int x, int y)
        {
            return Main.chest[GetChestID(x, y)];
        }

        public static Chest GetChestSafe(int x, int y)
        {
            int chest = GetChestID(x, y);
            return chest == -1 ? null : Main.chest[chest];
        }

        public static int GetChestID(int x, int y)
        {
            Tile tile = Main.tile[x, y];
            return Chest.FindChest(tile.frameX % 36 == 0 ? x : x - 1, tile.frameY == 0 ? y : y - 1);
        }

        //Should work for any size of chest, as long as chest location is upper right corner
        public static int GetVarSizeChestID(int x, int y)
        {
            Tile tile = Main.tile[x, y];
            TileObjectData tileData = TileObjectData.GetTileData(tile);
            return Chest.FindChest(x - tile.frameX / 18 % (tileData == null ? 1 : tileData.Width), y - tile.frameY / 18);
        }

        public static int GetTargetChestID(int x, int y, int dir)
        {
            return GetVarSizeChestID(x + xOffset[dir], y + yOffset[dir]);
        }

        public static ItemState DepositItem(int chest, int owner, Item[] items, Item item)
        {
            ItemState state = ItemState.SAME;
            for (int i = 0; i < items.Length; ++i)
            {
                if (item.IsTheSameAs(items[i]) && items[i].stack != items[i].maxStack)
                {
                    state = ItemState.CHANGED;

                    item.stack = items[i].stack - items[i].maxStack + item.stack;
                    items[i].stack = Math.Min(items[i].maxStack + item.stack, items[i].maxStack);

                    if (owner != -1)
                    {
                        NetMessage.SendData(32, owner, -1, "", chest, i, 0f, 0f, 0, 0, 0);
                    }

                    if (item.stack <= 0)
                    {
                        return ItemState.EMPTY;
                    }
                }
            }

            for (int i = 0; i < items.Length; ++i)
            {
                if (items[i].type == 0)
                {
                    items[i] = item;
                    //item.newAndShiny = true;

                    if (owner != -1)
                    {
                        NetMessage.SendData(32, owner, -1, "", chest, i, 0f, 0f, 0, 0, 0);
                    }

                    return ItemState.EMPTY;
                }
            }

            return state;
        }
    }
}
In the pre- 0.10 version, the SendData hook had a string in it. They replaced that with a class called NetworkText, so you can't just put a string there anymore and expect it to work. "" is an empty string and can be replaced with null, but Main.chest[player.chest].name is also a string and needs to be converted to NetworkText. I don't know how this is done, so look at the migration guide I showed you earlier for how to send text as a NetworkMessage. Look for the part that begins with NetMessage.SendData.
Also, You missed a few "" in Chest Utils.cs.
 
Oh, hi, can someone help me? Everytime I try to load any "major" mods, like Thorium or Calamity this error shows up:
Failed to resolve assembly: 'Terraria, Version=1.3.5.1, Culture=neutral, PublicKeyToken=null'
em Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
em Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
em Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
em Mono.Cecil.TypeReference.Resolve()
em Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
em Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
em Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
em Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
em Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArrayArgument(ArrayType type)
em Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
em Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
em Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
em Mono.Cecil.CustomAttribute.<Resolve>b__34_0(CustomAttribute attribute, MetadataReader reader)
em Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
em Mono.Cecil.CustomAttribute.Resolve()
em Mono.Cecil.CustomAttribute.get_ConstructorArguments()
em Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes(ICustomAttributeProvider provider)
em Mono.Cecil.ImmediateModuleReader.ReadType(TypeDefinition type)
em Mono.Cecil.ImmediateModuleReader.ReadTypes(Collection`1 types)
em Mono.Cecil.ImmediateModuleReader.ReadModule(ModuleDefinition module)
em Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
em Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
em Terraria.ModLoader.AssemblyManager.LoadedMod.EncapsulateReferences(Byte[] code)
em Terraria.ModLoader.AssemblyManager.LoadedMod.LoadAssemblies()
em Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad)
TL;DR: It says my terraria need to be in 1.3.5.1 or something? Please, can someone help me? Thanks :3
(Also I don't know if it's a mod loader error, since it makes my Terraria be in 1.3.5.2 or it's an error with the mod)
 
Oh.. I guess that not only me think that versions 0.10 and higher are tooo uncomfortable. Why you makes those useless changes that only makes modding harder? Really.
 
I'm getting this error when I try to load my mods, any body know why and how to fix it?

The mp3 sound file at Sounds/Music/DepthInvasion.mp3 failed to load
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Inner Exception:
Insufficient memory to continue the execution of the program.
at Microsoft.Xna.Framework.Helpers.GetExceptionFromResult(UInt32 result)
at Microsoft.Xna.Framework.Audio.SoundEffect.AllocateFormatAndData(Byte[] format, Byte[] data, Int32 offset, Int32 count)
at Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
at Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
at Terraria.ModLoader.Mod.Autoload()
 

tmodloader.png

Current version: v0.10.0.2
Compatible with Terraria 1.3.5.X
Steam Platforms: Windows, Mac, Linux
GOG Platforms: Windows, Mac, Linux

Note: The mod browser will sometimes go down during heavy load. Modders, please also provide your own downloads of your mod for whenever this happens.

  1. Introduction
  2. Creating Mods
    1. Documentation
    2. Example Mod
    3. Instructions
    4. Help and Resources
  3. Legal Stuff
  4. Credits
  5. Download
    1. Direct Download
    2. Open Source
    3. Past Versions
  6. Installation
  7. Version History
  8. The Future
  9. News


introduction.png

tModLoader is essentially a mod that provides a way to load your own mods without having to work directly with Terraria's source code itself. This means you can easily make mods that are compatible with other people's mods, save yourself the trouble of having to decompile and recompile Terraria.exe, and escape from having to understand all of the obscure "intricacies" of Terraria's source code. It is made to work for Terraria 1.3+.

tModLoader saves worlds and players separately from vanilla worlds and players. Vanilla worlds and players can be ported to tModLoader worlds and players simply by copying over save files. Modded content is saved in files separate from .plr and .wld files, so you can also port modded players and worlds back to vanilla at the cost of losing your modded stuff.

My goal for tModLoader it to make it simple as possible while giving the modder powerful control over the game. A secondary goal is that anyone who works with tModLoader enough will be able to make their own standalone mods. tModLoader is designed in a way as to minimize the effort required for me to update to future Terraria versions. Feel free to either suggest hooks or push hooks to Github (link in a later section).

Also please don't email me, I almost never check my email.



creating_mods.png

Documentation
Link to Documentation
The documentation contains everything you need to know about what tModLoader has to offer. It contains information on all the features, hooks, etc., in tModLoader, complete with descriptions on what everything is used for. Unlike other modding API's, this documentation is kept up-to-date as features are added. Do note that often it will even be ahead of the current released version.

Example Mod
I use an example mod to test features that I add to tModLoader. You can download a zip file here so you can use it to learn how to make your own things.
Example Mod v0.10.0.2 Download

Instructions

To create a mod, first run tModLoader. Click on the "Mod Sources" button in the main menu, then click on the "Open Sources" button to open the folder which contains your mod sources. In this folder, create another folder for your mod, then put all of your .cs files and .png files in that folder. When you are done, build your mod from the "Mod Sources" menu . If the mod failed to build, the game will show you one compile error, and give you an option to view all compile errors as a text file. If the mod successfully builds you will be returned to the main menu. If the game crashes or a mod fails to load, the game will display the error and also give you the option to view the error as a text file. Mods that crash on loading are automatically disabled. Mods are automatically enabled when they are built.

If you are using Mac/Linux, it is possible that your mod will fail to build, no matter what you do. In this case, you will have to pre-compile your mod (see documentation on build.txt for more info). Detailed instructions can be found here: http://forums.terraria.org/index.ph...der-a-modding-api.23726/page-526#post-1001200

To distribute a mod, once you have built it, click on the "Mods" button in the main menu, then click on the "Open Mods Folder" button. You will find a file with the .tmod extension for you to distribute.

To install someone else's mod, simply copy the .tmod file to your own Mods folder.

Help and Resources

Mod Skeleton Generator (use this to generate files to get you started on your mod)

http://forums.terraria.org/index.ph...amples-handy-code-snippets.28901/#post-656323

Tile Properties and stuff

I and other people who can help with problems can usually be found in the following chatrooms:
tModLoader Discord chat: https://discord.gg/YCJQAVW


tAPI IRC room: http://www.esper.net/publicirc.php (channel = #tapi)



legal_stuff.png

Disclaimer and Agreements
  • By downloading tModLoader, you agree to everything in this disclaimer and agreements.
  • I am not responsible for anything that happens to your computer if you download tModLoader. Common sense stuff.
  • Do not use tModLoader to do anything that breaks the Terraria Forums rules. In other words, the rules for making and sharing mods are the same as the rules for sharing mods on these forums; no removed items, no console content, etc.
  • Mods uploaded through the Mod Browser are tagged with your Steam username, so we will know if you do something bad.
  • You are allowed to mod tModLoader (similar to how tModLoader is a mod of Terraria), given that you provide a link to this thread.



credits.png

Special Thanks
You can support the tModLoader team with donations and get mentioned in the special thanks here: https://www.patreon.com/tModLoader



download.png

Current version: v0.10.0.2
Direct Download Links:
Steam: Windows | Mac | Linux
GOG Installer


Donations are always appreciated! https://www.patreon.com/tModLoader

Open Source
In case you want to see how messy my code has become, tModLoader is now open source! Feel free to suggest features either on this thread or over Github.
Github Repository Link

v0.10.0.1: Windows | Mac | Linux
v0.10: Windows | Mac | Linux

This link is needed to play on pre-v1.3.5 versions.
v0.9.2.3: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.2.2: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.2.1: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.2: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.1: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.0.3: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.0.2: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.0.1: Windows | Mac | Linux - Terraria v1.3.4.4
v0.9.0.0: Windows | Mac | Linux - Terraria v1.3.4.4
v0.8.3.5: Windows | Mac | Linux | GOG Windows - Terraria v1.3.3.3
v0.8.3.4: Windows | Mac | Linux | GOG Windows - Terraria v1.3.3.2
v0.8.3.3: Windows | Mac | Linux - Terraria v1.3.3.1
v0.8.3.2: Windows | Mac | Linux | GOG Windows - Terraria v1.3.2.1
v0.8.3.1: Windows | Mac | Linux | GOG Windows - Terraria v1.3.2.1
v0.8.3: Windows | Mac | Linux - Terraria v1.3.2.1
v0.8.2.1: Windows | Mac | Linux - Terraria v1.3.1.1
v0.8.2: Windows | Mac | Linux - Terraria v1.3.1.1
v0.8.1.2: Windows | Mac | Linux | GOG Windows - Terraria v1.3.1.1
v0.8.1.1: Windows | Mac | Linux - Terraria v1.3.1.1
v0.8.1: Windows | Mac | Linux - Terraria v1.3.1
v0.8: Windows | Mac | Linux - Terraria v1.3.0.8
v0.7.1.1: Windows | Mac | Linux - Terraria v1.3.0.8
v0.7.1: Windows | Mac | Linux - Terraria v1.3.0.8
v0.7: Windows | Mac | Linux - Terraria v1.3.0.8
v0.6: Windows | Mac | Linux - Terraria v1.3.0.8
v0.5: Windows - Terraria v1.3.0.8
v0.4.1: Windows - Terraria v1.3.0.8
v0.4: Windows - Terraria v1.3.0.8
v0.3.2.1: Windows - Terraria v1.3.0.7
v0.3.2: Windows - Terraria v1.3.0.7
v0.3.1.1: Windows - Terraria v1.3.0.7
v0.3.1: Windows - Terraria v1.3.0.7
v0.3.0.1: Windows - Terraria v1.3.0.7
v0.3: Windows - Terraria v1.3.0.7
v0.2.0.1: Windows - Terraria v1.3.0.7
v0.2: Windows - Terraria v1.3.0.7
v0.1.2: Windows - Terraria v1.3.0.6
v0.1.1: Windows - Terraria v1.3.0.5
v0.1: Windows - Terraria v1.3.0.3

If you're on Mac/Linux, you can download Mod Browser mods from here: http://javid.ddns.net/tModLoader/DirectModDownloadListing.php



installation.png

Instructions

Once your download is complete, you should have a zipped folder. Unzip this folder. Open the extracted folder and copy all the contents to your Terraria's Steam folder. You may wish to back-up your vanilla Terraria.exe file first. More detailed instructions are in the README file included with the download.



version_history.png

-Fixed GlobalNPC.PreDraw getting called when PostDraw should be called
-Made menus less prone to crashes
-Fixed Extract Mod menu crash
-Fixed Mac/Linux Server files
-Added PreUpdateMovement hook for ModPlayer
-NewProjectileDirect method in Projectile for simpler access to the Projectile instance
-Fixed a tile-preview flashing bug
-Fixed several dust lighting issues
-Added JumpHeight and JumpSpeed hooks for ModMountData
-Made MountLoader methods public
-Detect modder errors with TileObjectData.AddTile
-Report silent exceptions to modders
-Added ModifyDamageHitbox hook for projectiles
-Fixed a ModPlayer issue
-Fixed modded chests in world gen turning into normal chests
-Fixed fatal error on Mac/Linux
-PreSavePlayer and PostSavePlayer hooks
-FixedUIScrollBar and UIGrid
-Minor fixes and improvements
-Fixed bug where items can be duplicated in NPC shops
-Fixed bug where prefix effects can be stacked in NPC shops
-A few grass framing fixes
-Fixed a few instances where dropped items lose their ItemInfo
-Improved the performance of recipe groups
-Added ShiftClickSlot hook for ModPlayer
-Modded NPCs no longer need a matching display name
-Modded NPCs now persist when mods are unloaded then reloaded
-Updated to Terraria 1.3.5.2
-Added new ModTranslation system for names and tooltips
-All ID counts are now public
-Fixed bug where unloaded items aren't restored on reloading
-Updated my favorite color
-Built in tModReader functionality to the mods menu
-Renamed ExtraPickupSpace to ItemSpace and fixed a few bugs with it
-Renamed CanSpawn to SpawnChance
-Foolproofed modder errors with spawn weights
-Added PostAddRecipes hook
-RenderTargets are now public
-Greatly improved performance when inventory is closed
-Merged all Infos into Globals and added new global instance system
-Made numerous changes to autoloading
-Added mod-less overload for generic GetGlobals
-Improved performance of PlayerHooks
-Minor bugfixes
-Fixed Mod Browser not working on Mac
-Fixed bug where Mods menu crashes on Linux
-Fixed bug where tile entities are not restored when the mod is disabled/reenabled
-Fixed server ID mismatch bug when players and the server use different languages
-Fixed bug where CanPlace hook for tiles does not work
-More detailed error message for missing a Mod class
-Exception for recipe with too many ingredients
-Fixed bug where music boxes don't record stuff
-Added OnRespawn hook for ModPlayer
-Changed parameters for NetSend and NetReceive hooks for ModTileEntity
-Also fixed bug where modded tile entities sometimes would not sync
-Changed parameters for Mod.GetEquipTexture, Mod.GetEquipSlot, and Mod.GetAccessorySlot
-Fixed many freezing bugs resulting from GlobalItem
-Fixed bug where selling items makes them lose their ItemInfo
-Improved the speed and appearance of the mod browser
-Added the ability to suppress mod browser warnings
-Added object overload for ErrorLogger.Log
-More generic GetX and XType methods in Mod
-Added more Item.NewItem overloads
-Added Main.DiscoColor to get the rainbow color more easily
-Added Item.QuickSpawnClonedItem
-Fixed a bug preventing new users from using tModLoader ("save profile")
-Fixed another bug preventing new users from using tModLoader ("draw hands")
-ModCommands replace the ChatInput hook (ChatInput no longer exists)
-TagSerializable - allows easy serialization of classes into TagCompound
-Autoload Effects (.xnb) from the folder "Effects/" (allows for shaders)
-Mod PreSaveAndQuit -- Called when user clicks SaveAndQuit
-Mod HijackSendData -- Use with extreme caution.
-ModItem/GlobalItem PickAmmo -- Allows ammo item control over projectile spawned.
-ModItem/GlobalItem UseTimeMultiplier -- Allows you to change the effective useTime of an item.
-ModItem/GlobalItem MeleeSpeedMultiplier -- Allows you to change the effective useAnimation of an item.
-ModItem/GlobalItem CanPickup and ExtraPickupSpace -- for special pickup considerations
-ModTile AnimateIndividualTile -- Special animation per tile
-ModTile/GlobalTile SpecialDraw -- Draw Extras specially
-ModTile/GlobalTile FloorVisuals -- Allows for special things if standing on a tile.
-ModTile/GlobalTile PlaceInWorld -- Allows you to do something when this tile is placed.
-ModWall/GlobalWall PlaceInWorld -- Allows you to do something when this wall is placed.
-ModWorld PostDrawTiles -- Draw overlay
-ModProjectile/GlobalProjectile CutTiles -- Cut tiles, useful for lasers/etc. (see ExampleLaser)
-ModProjectile/GlobalProjectile GrapplePullSpeed -- Grapple miss retreat speed
-UIElement now has right click functionality
-ModTile/GlobalTile.DrawEffects
-ModProjectile/GlobalProjectile.TileCollideStyle
-ModItem/GlobalItem.VerticalWingSpeeds
-ModItem/GlobalItem.WingUpdate
-ModItem/GlobalItem.HorizontalWingSpeeds
-Mods are now correctly sorted, fixing many cross-platform bugs. (Such as ItemIDs out of sync, causing items to magically transform)
-Fixed an potential issue with trap projectiles
-Alternate Currency Tooltip fix
-The bug when player is killed by mod projectile
-Some Tile framing bugs
-GetWeaponDamage does not work for melee
-ModPlayer.GetWeaponKnockback not working for melee weapons
-World loading crash upon pressing a ModHotKey during loading
-Better memory management
-"type == SoundLoader.customSoundType " chat message spawn
-EquipTexture-only wings crash on logic
-Items in recipegroups now register as Material
-Player.DropItems removing ModItem/ItemInfo Data
-"Hotness" sort
-Mod Browser more responsive, no more duplicate entries
-Mod Browser and Mods menu will now notify of Mod dependencies
-Downgrade label to warn if Mod Browser version is less than current mod version
-View in Mod Browser button for Mod Packs -- Easily download mods from ModPacks you find on internet
-NextEnum and PreviousEnum
-Main.rand.NextBool
-Main.rand.NextFloat(maxValue)
-Main.rand.NextFloat(minValue, maxValue)
-Main.NewText(string, Color) overload
-NPCSpawnHelper for simplifying Spawn Conditions.
-Terraria.ID.NetmodeID for easy netMode value access (e.g. if (Main.netMode = NetmodeID.MultiplayerClient))
-Terraria.ID.LangID for easy language value access (e.g. if (Lang.lang == LangID.English))
-Terraria.ID.MountID now has const values for vanilla mounts
-Added some modder-error protections.
-Prevent modding mistake of duplicate ModItems with same name
-Escape now exits from mod-related menus back towards the main menu
-Very simple commandline mod browser in tmodloaderserver.
-Mod.Properties defaults to all True.
-GOG -> menu for steamid entry and a clear credentials button in settings
-Mac/Linux can now host servers
-Added support for modded tile entities
-Added PreHitWire hook for GlobalTile
-Added CanExplode hook for walls
-Added broadcast parameter to Mod.ChatInput
-Fixed bug where defender forge can't save modded items
-Minor fixes
-Fixed saving for Item Frames containing mod data
-Fixed GlobalItem Saving
-Fixed gores not disappearing
-Fixed Background flicker on reload
-Fixed DrawLifebar server bug
-Fixed Balloon Offset Bug
-Server command: ModList
-Fixed bug where modded NPC banner drops crash the game
-Fixed bug where worlds with modded walls can't load
-Changed save format for modded data of players and worlds
-Mod: Support for SpriteFonts packaged in Mods
-ModItem/GlobalItem: PreDrawInWorld and PostDrawInWorld now have "int whoAmI" as a parameter
-ModProjectile/GlobalProjectile: List<int> drawCacheProjsOverWiresUI added to DrawBehind hook
-ModProjectile/GlobalProjectile: CanCutTiles hook
-ModWorld: PreUpdate hook
-ModBrowser: Now displays time since last update
-ModBrowser: More responsive
-ModPacks: Delete Button
-ModPlayer: PlayerConnect, PlayerDisconnect, OnEnterWorld hooks
-ModNPC/GlobalNPC: BossHeadRotation bug fix
-ModHotKey: Hotkeys have been redesigned. HotKeyPressed no longer recommended to be used
-ModHotKey: Hotkey key bindings will now persist correctly
-Settings Menu: Options available.
-TexturePacks: Instead of the vanilla approach of 1 texture pack named Texture Pack.zip, all .zip in Terraria\ModLoader\TexturePacks will be loaded
-ModSources Menu: Now sorted by latest built
-IDs: New Generic overloads for getting IDs for various things
-All ModifyHit hooks related to Projectiles: Added a hitDirection parameter
-tModLoader: updated to Terraria 1.3.4.4 codebase
-Updated to Terraria 1.3.3.3
-Added mod packs - ability to enable/disable groups of mods at once
-Added ability to search mod browser by author
-Added ModifyInterfaceLayers hook
-DrawLayers can now modify the DrawInfo parameter
-Added whoAmI parameter to world-drawing hooks for items
-Made Main._drawInterfaceGameTime public
-Fixed bug where custom tile kill check uses liquid placement check
-Added modpath option for dedicated server command line
-Minor fixes and improvements
-Updated to Terraria 1.3.3.2
-Fixed bug where modded trees get drawn incorrectly
-Fixed a bug with modded walls beyond a certain ID
-Added ability to change modded tree top/branch frames
-Added fishing power parameter to ModPlayer.CatchFish
-Fixed bug where return value of TileLoader.Slope is ignored
-buildIgnore now accepts both slash types for directories
-Updated to Terraria 1.3.3.1
-Hopefully fixed Mac/Linux not being able to host servers
-Fixed bug where modded buffs beyond a certain ID cannot be synced
-Security for Mod Browser
-Minor fixes
-Fixed bug where modded items disappear upon sorting
-Added a weak mod dependency system
-Added support for biome backgrounds
-Added support for custom water and waterfall styles
-Added support for custom saplings, trees, palm trees, and cacti
-Added PostDrawInterface, PostDrawFullscreenMap, and PostUpdateInput hooks
-Added clientClone, SyncPlayer, and SendClientChanges hooks for ModPlayer
-Added ModifyZoom and ModifyScreenPosition hooks
-Added updateType field for ModGore
-Made all classes in Terraria.GameContent.UI.Elements public
-Made Main.rare public
-Added modpath option for dedicated server config
-Added search filter to Mods menu
-Disabled buggy hotbar scrolling during auto select
-Fixed bug where music boxes cannot record custom music
-Fixed world generation bugs involving modded tiles
-Updated to Terraria 1.3.2.1
--Added support for alternate ModNPC textures
--Added UsesPartyHat hook for ModNPC
-Added PreReforge and PostReforge hooks for items
-Added CustomBuffTipSize and DrawCustomBuffTip hooks for GobalBuff
-Added CanDamage and ShouldUpdatePosition hooks for projectiles
-Added Clone hooks for entity infos
-Fixed bug where ModifyBuffTip is not called from inventory menu
-Fixed bug where modded NPCs aren't listed under banner buff tooltip
-Fixed bug where ModItem and EntityInfo are not initialized during mod-loading
-Fixed bug where GlobalItem saving hooks are called for empty item slots
-Made Wiring._currentWireColor public
-Added SaveCustomData and LoadCustomData hooks for GlobalItem
-Added client/server sync hooks for ModWorld
-Added client/server sync hooks for ModPlayer custom biomes
-Added hook for complete control over all item tooltips
-Added CanUseAbility and UseAbility hooks for ModMountData
-Added RecipeFinder and RecipeEditor for easy recipe editing
-Added hook for drawing NPC health bars
-Support for preserving unloaded mod tiles
-Name property for mod textures are now assigned
-Animations for opening/closing modded chests
-Made Main.DrawHealthBar public
-Made Terraria.Graphics.Shaders.GameShaders public
-Fixed bug where ConsumeItem is called for wrong item
-RecipeGroup bugfixes
-Fixed bug where ModGore code does not autoload
-Added support for dressers
-Fixed bug where jungle temple door can't be unlocked... again
-Fixed a ton of bugs with modded chests and dressers
-Made Wiring.DeActive and Wiring.ReActive public
-Modded maximum life now displays in character selection
-Fixed bug where certain modded NPCs disappear upon being hit on expert servers
-Fixed bug where ModProjectile extra AI is not synced between clients/server
-Updated to Terraria v1.3.1.1
-Added the ability to clone new instances of mod entities
-Fixed bug where explosives don't kill tiles on servers
-Servers now sync mods with clients that connect
-Added the ability to send custom net messages between servers/clients
-Added the ability to tamper with net messages
-Added ModifyTransformMatrix hook for drawing
-Updated to Terraria 1.3.1
-I can't tell if I'm forgetting anything...
Server Bugs:
-Fixed server sync bug with OnPickup hook for items
-Fixed server bug where chests are not synced properly
-Fixed bug where Steam servers don't work
-Hopefully fixed ItemLoader.GetAlpha crash for clients on servers
-Hopefully fixed NPCs disappearing on servers? Please?
-Fixed server bug where custom item data is not synced
-Fixed server bug where custom town NPCs do not work
Other Bugs:
-Fixed bug where bottom half of long hair does not draw
-Fixed bug where modded tiles crashed the game in early stages of world generation
-Fixed bug where Start Bag cannot contain vanilla items
-Fixed bug where Mod.GetEquipTexture always returns null
-Mods with sounds now load for people without sound cards
-Fixed NPC.CloneDefaults with buffImmune
-Fixed bug where SetMatch hook doesn't work at all
-Added the ability to build and debug mods from Visual Studio
-Improved the .tmod file format
-Added the ability to support future .tmod file format changes
-Renamed Other.dll to Mono.dll for noCompile mod-building
-Mods can now reference embedded dlls
-Added the ability to compile mods in C# 6
-Made the Mod Browser more secure
-ItemIO can now save items in general, including vanilla items
-Mods menu now displays how much stuff each mod adds
-Detect and display modder errors in LoadCustomData
-Huge performance improvements
-Changed structure of equipment update code to make it easy to create new equipment slots
-Converted some local world generation variables to static fields
-Made Player.jumpSpeed and Player.jumpHeight public
-Made a bunch of Mount fields public
-Added April Fools (sorry this was late)
-Added GlobalRecipe and RecipeAvailable hook for recipes
-Added gender parameter to SetMatch hook for items
-Added generic GetModX accessors for reduced redundancy
-Added OnCraft hook for recipes and items
-Added TileCountsAvailable hook for ModWorld
-Added GetMapBackgroundImage hook for ModPlayer
-Added ModifyBuffTip hook for buffs
-Added option to use constructor for cloned ModPlayers
-Added DrawEffects and CanExplode hooks for tiles
-Made code source files hidden from tModReader based on hideCode instead of hideResources
-Servers no longer crash on settling liquids or liquid updates
-Pause menu now shows for clients on steam servers
-Added ResetNearbyTileEffects hook for ModWorld
-Servers now work (so far only on Windows)
-Fixed mods with music being unable to load on Mac/Linux
-Fixed severe FPS drop when armor is equipped and visible
-Fixed bug where custom data could duplicate and corrupt .tplr
-Fixed bug where ItemInfo is not cloned by Item.Clone
-Fixed bug where "endless" ammo can get prefixes
-Fixed bug where modded chest names start out empty
-Fixed vanilla bug with DrawData.useDestinationRectangle
-Added ModWorld
-Added Initialize hook for ModPlayer and ModWorld
-Added SaveCustomData and LoadCustomData hooks for ModWorld
-Added ModifyWorldGenTasks and PostWorldGen hooks for ModWorld
-Added PostUpdate hook for ModWorld
-Added Dangersense hook for tiles
-Added hideVisual parameter to UpdateAccessory hook for items
-Added DrawBehind hook for projectiles
-Added scroll bar to mod info screen
-Added ability to search in the mod browser
-Added the ability to exclude certain files from .tmod resources
-Compiler warnings are now included in the compiler error log file
-Added ModPlayer
-Added ResetEffects and UpdateDead hooks
-Added SaveCustomData and LoadCustomData hooks
-Added SetupStartInventory hook
-Added UpdateBiomes and UpdateBiomeVisuals hooks
-Added UpdateBadLifeRegen, UpdateLifeRegen, and NaturalLifeRegen hooks
-Added PreUpdate, SetControls, PreUpdateBuffs, and PostUpdateBuffs hooks
-Added PostUpdateEquips, PostUpdateMiscEffects, PostUpdateRunSpeeds, and PostUpdate hooks
-Added FrameEffects hook
-Added PreHurt, Hurt, and PostHurt hooks
-Added PreKill and Kill hooks
-Added PreItemCheck and PostItemCheck hooks
-Added GetWeaponDamage and GetWeaponKnockback hooks
-Added ConsumeAmmo, Shoot, and MeleeEffects hooks
-Added OnHitAnything hook
-Added CanHitNPC, ModifyHitNPC, and OnHitNPC hooks
-Added CanHitNPCWithProj, ModifyHitNPCWithProj, and OnHitNPCWithProj hooks
-Added CanHitPvp, ModifyHitPvp, and OnHitPvp hooks
-Added CanHitPvpWithProj, ModifyHitPvpWithProj, and OnHitPvpWithProj hooks
-Added CanBeHitByNPC, ModifyHitByNPC, and OnHitByNPC hooks
-Added CanBeHitByProjectile, ModifyHitByProjectile, and OnHitByProjectile hooks
-Added CatchFish, GetFishingLevel, AnglerQuestReward, and GetDyeTraderReward hooks
-Added DrawEffects, ModifyDrawLayers, and ModifyDrawHeadLayers hooks
-Finished buff support
-Added GlobalBuff
-Added Update(NPC) hook
-Added ReApply hooks
-Added canBeCleared and longerExpertDebuff fields
-Revamped equipment texture system (Added EquipTexture)
-Added all vanity-related ModItem hooks to EquipTexture
-Added Clone hook for ModItem
-Added ExtractinatorUse hook
-Added AutoLightSelect hook for ModItem
-Added PostUpdate hook
-Added SetMatch hook
-Added UpdateVanity hook
-Added GetWeaponDamage and GetWeaponKnockback hooks
-Added projOnSwing field
-Added CaughtFishStack, IsQuestFish, IsAnglerQuestAvailable, and AnglerQuestChat hooks
-Added HoldoutOffset and HoldoutOrigin hooks
-Added DrawHands, ArmorDrawColor, and ArmorArmGlowMask hooks
-Added DrawBody and DrawLegs hooks
-Added support for alternate use functions (right-clicking)
-ItemLoader hooks are now called for hotkey presses and right-click-equips
-Added CloneDefaults methods for Item
-Added disableSmartCursor field and AutoSelect hook for ModTile
-Added support for torches
-Added SetDrawPositions hook for ModTile
-Added WalkDust and MouseOverFar hooks
-Added hooks for grappling hook projectiles
-Added PreDrawExtras hook for projectiles
-Added drawHeldProjInFrontOfHeldItemAndArms field for ModProjectile
-Added support for contact-damage minion projectiles
-Added CloneDefaults method for Projectile
-Added CheckActive and CheckDead hooks for NPCs
-Added DrawEffects hook for NPCs
-Added ResetEffects and UpdateLifeRegen hooks for NPCs
-Added CloneDefaults methods for NPC
-Added PostSetupContent hook for Mod
-Added MidUpdate hook for ModDust
-Added GetLoadedMods method for ModLoader
-Finished music support
-Added support for screen shaders and custom skies
-Custom saved modded item data now persists through the mod being unloaded
-Added DrawLayer and DrawInfo system for custom drawing
-Added EntityInfo system for storing information per entity
-Added the ability to manage mods published on the Mod Browser
-Added sorting buttons to the Mod Browser
-The Mod Browser now checks for tModLoader updates
-Added homepage link and description to mod files
-Added mod info buttons to Mods menu
-Made Terraria.ModLoader.IO.ItemIO public
-Made all hook calls public
-Exception messages now show inner exceptions
-Warnings are now hidden from compile error messages and logs
-Added tModLoader version information to .tmod file structure
-Probably other stuff I forgot
-Mods now unload in the reverse order they were loaded in
-ModifyHitNPC and ModifyHitByItem for NPCs can now modify damage
-Modded items lying in the world now animate at the correct speed
-The Extractinator no longer accepts every single modded item ever
-Doors no longer cause chaos on servers
-Abstract classes are no longer autoloaded
-Fixed severe vanilla-CraftGroup-related FPS drop
-Word wrap on exception messages and mod info no longer splits up words
-Proofed ModRecipe methods against modder mistakes
-Mac support
-.cs files are no longer saved as .tmod resources (woops!)
-Made mods compatible cross-platform
-Added support for building .dll files as mods
-Added Unload hook for Mod
-Revamped how minimap handles mod tiles and walls to cut down minimap's RAM usage
-Fixed bug that made .twld files larger than they had to be
-Made some private Projectile fields public
-Fixed bug where Jungle Temple door cannot be unlocked
-Fixed bug with sign GUI
-Fixed bug where cloud saves are not separate from vanilla cloud saves
-Added mod browser - an easy way to upload / download mods
-Basic buff support
-Added support for platform-like tiles
-Fixed bug where miscellaneous custom sounds don't work
-Improved saving for mannequins and item frames with modded items
-Gave ModDusts their own types
-Added hooks for vanity effects for armor sets
-Linux support
-Made a fancy installer
-Partial music support
-Added "Open Mods Folder" button to Mods menu
-Added support for animating vanilla tiles
-Added support for using vanilla textures
-Two mods can no longer share the same internal name
-Mods must now share names with the folder that contains their content
-Added a default mod that will always be enabled
-Loading mods now completely refreshes recipe list
-Added support for storing items whose mods are unloaded
-Added support for custom NPC banners
-Added support for singleplayer chat + ChatInput hook
-Added support for custom sounds
-Improved system for gores
-Added partial support for mounts
-Added support for miscellaneous file resources in .tmod files
-Added CanTownNPCSpawn and CheckConditions hooks for NPCs
-Added TownNPCName and GetChat hooks for NPCs
-Added SetChatButtons and OnChatButtonClicked hook for NPCs
-Added SetupShop and SetupTravelShop hooks for NPCs
-Fixed bug where locked Jungle Temple door can be opened
-Added BuffTownNPC hook
-Added TownNPCAttackStrength, TownNPCAttackCooldown, TownNPCAttackProj, TownNPCAttackProjSpeed hooks for NPCs
-Added TownNPCAttackShoot, TownNPCAttackMagic, and TownNPCAttackSwing hooks for NPCs
-Added DrawTownAttackGun and DrawTownAttackSwing hooks for NPCs
-Added ScaleExpertStats hook for NPCs
-Added PreAI, AI, PostAI, SendExtraAI, and ReceiveExtraAI hooks for projectiles and NPCs
-Added FindFrame and HitEffect hooks for NPCs
-Added aiType field for ModProjectile and ModNPC + animationType field for ModNPC
-Added support for gores
-Added TileCollideStyle, OnTileCollide, PreKill, and Kill hooks for projectiles
-Added PreNPCLoot and NPCLoot hooks for NPCs
-Added BossLoot hook and bossBag field for NPCs
-Made it easier to customize vanilla NPC loot
-Added CanHitNPC and CanHitPvp hooks for items
-Added CanHitNPC, ModifyHitNPC, and ModifyHitNPC hooks for projectiles
-Added CanHitPvp, ModifyHitPvp, and OnHitPvp hooks for projectiles
-Added CanHitPlayer, ModifyHitPlayer, and OnHitPlayer hooks for projectiles
-Added CanHitPlayer, ModifyHitPlayer, and OnHitPlayer hooks for NPCs
-Added CanHitNPC, ModifyHitNPC, and OnHitNPC hooks for NPCs
-Added CanBeHitByPlayer, ModifyHitByPlayer, and OnHitByPlayer hooks for NPCs
-Added CanBeHitByProjectile, ModifyHitByProjectile, and OnHitByProjectile hooks for NPCs
-Added Colliding hook for projectiles and StrikeNPC hook for NPCs
-Added support for NPC map icons
-Added BossHeadSlot, BossHeadRotation, and BossHeadSpriteEffects hooks for NPCs
-Added support for NPC music
-Added GetAlpha, drawOffset, PreDraw, and PostDraw hooks for projectiles
-Added GetAlpha, PreDraw, drawOffsetY, and PostDraw hooks for NPCs
-Added EditSpawnRate, EditSpawnRange, CanSpawn, EditSpawnPool, and SpawnNPC hooks for NPCs
-Added OpenBossBag hook for items
-Added NearbyEffects hook for tiles
-Code is now optimized by compiler
-Deleting players and worlds will now also delete the associated .tplr and .twld files
-Fixed bug where stackable mod items (ie ammo) can have prefixes
-Fixed bug where vanilla NPC display names are wrong
-Fixed bug where open modded doors invalidate houses
-Removed a log write I accidentally left in
-Possibly other stuff I've forgotten
-Updated to Terraria 1.3.0.8
-Modded world and player data now saves in separate .tplr and .twld files
-Added tModLoader version to main menu
-Added support for theoretically infinite recipes
-Improved error-handling
-Added support for crafting groups
-Added PreOpenVanillaBag and OpenVanillaBag hooks for GlobalItem
-Gave tModLoader exe an (uncreative) icon
-Fixed bug where multi-tile subtiles and alternates are not checked
-Fixed bug where Main.tileValue doesn't work for modded tiles
-Added CanKillTile hook for tiles
-Added support for doors, chests, and beds
-Fixed assembly resolve for dll and mod references
-Added GrabRange, GrabStyle, and OnPickup hooks for items
-Bugfixed custom projectiles and NPCs
-Finally fixed bug where "Build + Reload" wouldn't unload mods
-Hopefully fixed dll reference system
-Autoloading now occurs before manual loading
-Added README to installation
-Added support for multiple global entities per mod
-Added support for autoloading global entities
-Added support for autoloading multiple EquipTypes per item
-Fixed bug where AddTooltip duplicates tooltips
-Improved dll reference system
-Fixed bug where missing equipment textures crashes the game
-Made WorldGen class public
-Added support for walls
--Added support for wall kill sounds, dust, drops, and kill-related hooks
--Added support for wall map colors and names, and related hooks
--Added ModifyLight and RandomUpdate hooks for walls
--Added AnimateWall, PreDraw, and PostDraw hooks for walls
-Added MouseOver and Slope hooks for tiles
-Added support for very basic projectiles and NPCs (Untested)
-Wiring._wireList is now public
-Fixed bug where GlobalItem.SetDefaults did not change vanilla names and tooltips
-Added build properties to specify display and dependency stuff
--Mod author and version are now build properties
--Added support for mod and dll dependencies
-Modified WorldFile.ValidateWorld so worlds containing modded stuff can load
-Added support for custom tiles (ModTile and GlobalTile)
--Added support for tile kill sounds, dust, drops, and kill-related hooks
--Added support for custom TileObjectData and multi-tile blocks
--Added ModifyLight, SetSpriteEffects, AnimateTile, PreDraw, and PostDraw hooks for tiles
--Added support for tile map colors and names, and related hooks
--Added RandomUpdate and TileFrame hooks for tiles
--Added mineResistance and minPick fields for ModTile
--Added CanPlace and AdjTiles hooks for tiles
--Added RightClick and HitWire hooks for tiles
-Added ConsumeItem hook for ModRecipe
-Added PreDrawInInventory and PostDrawInInventory hooks for items
-Fixed bug with removing custom armor from mannequins
-Improved error-handling for missing textures
-Safeproofed installation process
-Mod.Load is no longer abstract
-Removed some log writes that I accidentally left in
-Fixed bug with custom item data saving
-Mods now build as a single file that includes image resources
-Added support for automatically loading items, etc.
-Updated to Terraria 1.3.0.7
-Added ModItem.AddRecipes hook
-Added support for custom dust through ModDust
-Added CanEquipAccessory hook for items
-Added GlobalNPC with PreNPCLoot and NPCLoot hooks since everyone wants that
-Added ModItem.SaveCustomData and ModItem.LoadCustomData hooks
-Made tooltips easier to add
-Mods that crash the game while loading are now auto-disabled
-Mods are now auto-enabled when they are built
-Added a button to the Mod Sources menu to open the Mod Sources folder
-In-game error messages now appear when the game would have crashed and when a build fails
-Item display names can now be separated from internal names in the SetDefault hook
-Added a ton of hooks for ModItem and GlobalItem
--CanUseItem, UseStyle, UseItemFrame, UseItem, and ConsumeItem
--HoldStyle, HoldItem, and HoldItemFrame
--Shoot, ConsumeAmmo, UseItemHitbox, and MeleeEffects
--ModifyHitNPC, OnHitNPC, ModifyHitPvp, and OnHitPvp
--UpdateInventory, UpdateEquip, UpdateAccessory, IsArmorSet, and UpdateArmorSet
--CanRightClick, RightClick, and Update
--VerticalWingSpeeds and HorizontalWingSpeeds
--GetAnimation (ModItem only), GetAlpha, PreDrawInWorld, and PostDrawInWorld
-Added support for armors and accessories
-Fixed decompile bug that caused minimaps to not save
-Updated to Terraria v1.3.0.6
-Fixed missing .dll bug when building mods
-Split ModLoader class into ModLoader and ItemLoader
-Slightly changed the way modded items are saved
-Updated to Terraria v1.3.0.5
-Added support for prefixes for modded items
-Vastly improved the GUI for building and loading mods
--Menu shows status of loading and building mods
--Added menus that show lists of mods and mod sources
--Added the ability to enable and disable mods
--Added the ability to build mods individually
-Added GlobalItem
-Support for mods, recipes, and basic items



the_future.png

My goals for the future:

-Add hook to override player physics
-Fix bug where modded backgrounds aren't captured by camera mode
-Add hook for manually calling NPCLoot
-Add PreSave hook
-Add PreUpdate hook for ModWorld
-Add hook for bait consumption
-Add global hook for dust
-Add support for custom wing framing
-Add music priority system
-Add option to delete unloaded save content
-More mount hooks
-Add more general game hooks?

Tentative Future Plans
Hooks for mounts
Hooks for interface
ModOptions
Further in the future: JSON support + other stuff I'm forgetting + full release



news.png

(Updated June 27, 2017) v0.10.0.2 has been released: https://forums.terraria.org/index.p...der-a-modding-api.23726/page-887#post-1403773

(Updated June 8, 2017) If you ever feel like donating, we now have a Patreon: https://www.patreon.com/tModLoader

(Updated June 8, 2017) v0.10.0.1 has been released: https://forums.terraria.org/index.p...der-a-modding-api.23726/page-870#post-1385193

(Updated June 5, 2017) v0.10 has been released. Updated to Terraria 1.3.5.2: https://forums.terraria.org/index.p...der-a-modding-api.23726/page-862#post-1382257


I can't play multiplayer with my friends ever since I downloaded this. I tried verifying integrity of files, and it said one file failed to validate. Please help me ASAP.
 
I don't know where there are any tutorials, but you use the Update hook to do stuff to a NPC. An empty hook looks like this.
Code:
public override void Update(NPC npc, ref int buffIndex)
        {
            //do stuff to the NPC here
        }


In the pre- 0.10 version, the SendData hook had a string in it. They replaced that with a class called NetworkText, so you can't just put a string there anymore and expect it to work. "" is an empty string and can be replaced with null, but Main.chest[player.chest].name is also a string and needs to be converted to NetworkText. I don't know how this is done, so look at the migration guide I showed you earlier for how to send text as a NetworkMessage. Look for the part that begins with NetMessage.SendData.
Also, You missed a few "" in Chest Utils.cs.
I only found this:
NetMessage.SendData



If you are using a method that had “” as the string parameter, you can just change “” to null.



If you are using MessageID.ChatText, aka “25”, to send a chat string, you need to change it like this:



if (Main.netMode == 0)

{

Main.NewText(Lang.misc[29].Value, 50, 255, 130, false);

}

if (Main.netMode == 2)

{

NetMessage.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130), -1);

}



If you weren’t using a vanilla message, you would first add a ModTranslation in Load and then use that:

Mod.Load:

ModTranslation text = CreateTranslation("VolcanoWarning");

text.SetDefault("Did you hear something....A Volcano! Find Cover!");

AddTranslation(text);

Usage:

string key = "Mods.ExampleMod.VolcanoWarning";

Color messageColor = Color.Orange;

if (Main.netMode == 2) // Server

{

NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);

}

else if (Main.netMode == 0) // Single Player

{

Main.NewText(Language.GetTextValue(key), messageColor);

}

I tried to use .ToNetworkText() after Main.chest[player.chest].name , but it didn't work and now I'm stuck again
 
Last edited:
I am getting stuck when joining multiplayer. The client hosting is fine, but any other joining player gets stuck on "Requesting world information" and sometimes after a long time you get a "lost connection" message.

Mods:
Thorium
Calamity
Tremor
Wireless
Tinkerings
Project logic
Variable potion sickness
Spirit
Wing slot
Recipe browser
Gravestone killer
Itemtronics
What mod is this from


Please help me solve this issue.
I'm having this issue & cannot seem to get help with it. Did you ever get this resolved? If so, what did you do?
 
I hope this is the right place to put this...
So I decided to start modding today, so I open Steam, and go on tModloader. I open it up and it tells me to select a language (which it never does), and then it shows the "Finding Mods" loading screen, and then a couple seconds later it just crashes. I opened up event viewer and found two errors. Here they are... (Also, I've used tModloader many times and this has NEVER happened.)
Faulting application name: ModdedT.exe, version: 1.3.5.1, time stamp: 0x5934ec95
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x1eab5c76
Faulting process id: 0xd98
Faulting application start time: 0x01d2f1e0eb55b452
Faulting application path: C:\Program Files (x86)\Steam\steamapps\common\Terraria\ModdedT.exe
Faulting module path: unknown
Report Id: 7ad6eb4b-5dd4-11e7-bf8b-ac220b0ddb05
Faulting package full name:
Faulting package-relative application ID:

Application: ModdedT.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at Terraria.ModLoader.ModLoader.IsEnabled(Terraria.ModLoader.IO.TmodFile)
at System.Linq.Enumerable+WhereSelectArrayIterator`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Linq.Enumerable+WhereEnumerableIterator`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Collections.Generic.List`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>)
at System.Linq.Enumerable.ToList[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at Terraria.ModLoader.ModLoader.LoadMods()
at Terraria.ModLoader.ModLoader.do_Load(System.Object)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Okay so I actually found a solution to my problem. My mods were likely corrupted, so I deleted the Mods folder in the My Games/Terraria/ ModLoader and it started working properly! (just in case if anybody else was having the same problem)
 
upload_2017-7-2_13-6-55.png

Since I downloaded the most recent version of Tmodloader, I get this notice on a couple of mods I used, now I can't use them and I don't know how to fix it. Does anybody know what to do or how to fix it?
 

Attachments

  • upload_2017-7-2_13-6-36.png
    upload_2017-7-2_13-6-36.png
    755.8 KB · Views: 305
Screenshot 2017-07-02 18.02.58.png
Screenshot 2017-07-02 18.03.44.png
Screenshot 2017-07-02 18.04.50.png
Screenshot 2017-07-02 18.07.21.png
Screenshot 2017-07-02 18.08.04.png
Screenshot 2017-07-02 18.08.34.png
Every time I attempt to load my mods all of these notices show up. Can someone show me how to fix these?
Or do I need to go to each individual mod thread to ask about the corresponding issue?
 
Back
Top Bottom