Standalone [1.3] tModLoader - A Modding API

"-Added ModifyTransformMatrix hook for drawing"
What is that hook?
It allows you to modify the graphics transform matrix for the screen drawing. For example, Example Mod's Volcano now shakes your screen.

Here is how it looked earlier. It's a little more violent now.

 
I have a question..
With music from the vanilla game you can check

Main.music[4].IsPlaying

if you need to check music.

What to do if you want to check if the music from the mod?

P.S. Pardon my blunt translation
 
I have error with "mod.GetPacket()"
"Terraria.ModLoader.Mod" doesn't contain a definition for "GetPacket". Unable to find the extension method "GetPacket", receiving a first argument of type "Terraria.ModLoader.Mod"
 
I have a question..
With music from the vanilla game you can check

Main.music[4].IsPlaying

if you need to check music.

What to do if you want to check if the music from the mod?

P.S. Pardon my blunt translation
Main.curMusic is an int representing the current music.

You can check it against MusicID.SongName for vanilla music.

For mod music, you would check it against something like "mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic");"
[doublepost=1464508351,1464508302][/doublepost]
I have error with "mod.GetPacket()"
"Terraria.ModLoader.Mod" doesn't contain a definition for "GetPacket". Unable to find the extension method "GetPacket", receiving a first argument of type "Terraria.ModLoader.Mod"
Sounds like you are running an old version of tmodloader
 
Main.curMusic is an int representing the current music.

You can check it against MusicID.SongName for vanilla music.

For mod music, you would check it against something like "mod.GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic");"
[doublepost=1464508351,1464508302][/doublepost]
Sounds like you are running an old version of tmodloader
I've already downloaded new version of tModLoader, Visual Studio is see this method; Also when i'm use spriteBatch method (which was working on previous version tML), my inventory has disappeared except first slot.
 
I've already downloaded new version of tModLoader, Visual Studio is see this method; Also when i'm use spriteBatch method (which was working on previous version tML), my inventory has disappeared except first slot.
Oh, i'm sorry, inventory is drowing now, but first error has remained
 
Oh, i'm sorry, inventory is drowing now, but first error has remained
VS sees it but when you build in game it doesn't know about GetPacket, huh? When you installed the update, you copied over all the files, not just the Terraria.exe, right? Post the code and the exact error (prntscreen it), that should help.
 
I have some new errors with my mod, fuuuuuuuuuuun.

The code:
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace CakeMod.Items.Weapons
{
    public class HVM001 : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "HVM 001";   
            item.damage = 8; 
            item.ranged = true;  
            item.width = 36;    
            item.height = 25;  
            item.toolTip = "Standard issue combat forces sidearm. Reliable and functional."; 
            item.useTime = 14;  
            item.useAnimation = 20;
            item.useStyle = 5;   
            item.noMelee = true;
            item.knockBack = 0;
            item.value = 1000;
            item.rare = 2;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 10;
            item.shootSpeed = 16f;
            item.useAmmo = ProjectileID.Bullet;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CopperBar, 10);
            recipe.AddIngredient(ItemID.IronBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

       

       
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.TinBar, 10);
            recipe.AddIngredient(ItemID.LeadBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

       

       
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CopperBar, 10);
            recipe.AddIngredient(ItemID.LeadBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

       

       
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.TinBar, 10);
            recipe.AddIngredient(ItemID.IronBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

        }
    }
}

The error:
Code:
c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\HVM001.cs(42,23) : error CS0128: A local variable named 'recipe' is already defined in this scope

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\HVM001.cs(52,23) : error CS0128: A local variable named 'recipe' is already defined in this scope

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\HVM001.cs(62,23) : error CS0128: A local variable named 'recipe' is already defined in this scope


BTW that error with the weapon stats not changing after a recompile and reload is still a problem, even updating TModLoader from 0.8 to 0.8.1.0 didn't help.
 
I have some new errors with my mod, fuuuuuuuuuuun.

The code:
Code:
using Terraria.ID;
using Terraria.ModLoader;

namespace CakeMod.Items.Weapons
{
    public class HVM001 : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "HVM 001";  
            item.damage = 8;
            item.ranged = true; 
            item.width = 36;   
            item.height = 25; 
            item.toolTip = "Standard issue combat forces sidearm. Reliable and functional.";
            item.useTime = 14; 
            item.useAnimation = 20;
            item.useStyle = 5;  
            item.noMelee = true;
            item.knockBack = 0;
            item.value = 1000;
            item.rare = 2;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 10;
            item.shootSpeed = 16f;
            item.useAmmo = ProjectileID.Bullet;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CopperBar, 10);
            recipe.AddIngredient(ItemID.IronBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

      

      
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.TinBar, 10);
            recipe.AddIngredient(ItemID.LeadBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

      

      
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.CopperBar, 10);
            recipe.AddIngredient(ItemID.LeadBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

      

      
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.TinBar, 10);
            recipe.AddIngredient(ItemID.IronBar, 10);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this);
            recipe.AddRecipe();

        }
    }
}

The error:
Code:
c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\HVM001.cs(42,23) : error CS0128: A local variable named 'recipe' is already defined in this scope

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\HVM001.cs(52,23) : error CS0128: A local variable named 'recipe' is already defined in this scope

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\HVM001.cs(62,23) : error CS0128: A local variable named 'recipe' is already defined in this scope

BTW that error with the weapon stats not changing after a recompile and reload is still a problem, even updating TModLoader from 0.8 to 0.8.1.0 didn't help.
After you do " ModRecipe recipe = new ModRecipe(mod);" the first time, the rest will all be " recipe = new ModRecipe(mod);"

You don't have any .dll files in that folder, do you? I'm stumped what could be happening there.
 
VS sees it but when you build in game it doesn't know about GetPacket, huh? When you installed the update, you copied over all the files, not just the Terraria.exe, right? Post the code and the exact error (prntscreen it), that should help.
I've installed all files with Terraria.exe
if (Main.netMode == 2)
{
var netMessage = mod.GetPacket();
netMessage.Write(StageForHunger);
netMessage.Send();
}
 
I think this could be a bug:

NearbyEffects is called whenever a player is near a tile, but in MP, it is only called in the Client-Side, not in Server-Side

Is it a bug?
 
You don't have any .dll files in that folder, do you? I'm stumped what could be happening there.
Nope, no .dll files.

Some moar info on that bug, I tried copying the files (not the .tmod ones, the .cs and .png ones) to another PC, compiled and reloaded it, the weapons still had the wrong stats, that was a PC that has never had TModLoader on it, and I only just updated Terraria on it to 1.3.1,

I will send you a PM with a download to the mod.
 
I keep getting this error when I try to build a mod:
error CS1704: Es wurde bereits eine Assembly mit dem einfachen Namen 'MP3Sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null importiert. Entfernen Sie einen der Verweise, oder signieren Sie die Verweise, damit sie parallel verwendet werden können.
I don't know why it's written in german.
 
Last edited:
Does the crashing involve command developer tools? I wanted to take one of the worlds from trod loader so I changed it from a .twld to just a .wld and when I went to the worlds menu in terraria it asked for control of the computer I said no and it crashed.
 
I keep getting this error when I try to build a mod:
error CS1704: An Assembly with the easy name: 'MP3Sharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null was already used. Remove one of those references or sign them, so they can be used parallel.

Go into your Terraria Folder (Where your Teraria.exe is) and delete the Data MP3Sharp
 
Back
Top Bottom