tModLoader Official tModLoader Help Thread

I'm having an error with some of my code. When I tried to build it, it displayed this message:

c:\Users\J Simp\Documents\My Games\Terraria\ModLoader\Mod Sources\GracelessMod\Items\Armor\NaturalHood.cs(28,63) : error CS0118: 'GracelessMod.Items' is a 'namespace' but is used like a 'type'

I searched everywhere within my code, but I could not find a problem. I would appreciate any help I could get on the subject.

Code Causing Error:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GracelessMod.Items.Armor
{
public class NaturalHood : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Head);
return true;
}

public override void SetDefaults()
{
item.name = "Natural Hood";
item.width = 18;
item.height = 18;
item.toolTip = "You can hear the call of the wild drumming in your ear";
AddTooltip2("+20% Summon Knockback");
item.value = 10000;
item.rare = 1;
item.defense = 1;
}

public override bool IsArmorSet(Item head, Item body, Items legs)
{
return body.type == mod.ItemType("NaturalRobe") && legs.type = null;
}

public override void UpdateArmorSet(Player player)
{
player.summonKnockback *= 1.20F;
}

public override void UpdateEquip(Player player)
{
player.moveSpeed += 0.05F;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "EssenseOfGaia", 2);
recipe.AddIngredient(null, "Wood", 15);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 
I'm having an error with some of my code. When I tried to build it, it displayed this message:

c:\Users\J Simp\Documents\My Games\Terraria\ModLoader\Mod Sources\GracelessMod\Items\Armor\NaturalHood.cs(28,63) : error CS0118: 'GracelessMod.Items' is a 'namespace' but is used like a 'type'

I searched everywhere within my code, but I could not find a problem. I would appreciate any help I could get on the subject.

Code Causing Error:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GracelessMod.Items.Armor
{
public class NaturalHood : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Head);
return true;
}

public override void SetDefaults()
{
item.name = "Natural Hood";
item.width = 18;
item.height = 18;
item.toolTip = "You can hear the call of the wild drumming in your ear";
AddTooltip2("+20% Summon Knockback");
item.value = 10000;
item.rare = 1;
item.defense = 1;
}

public override bool IsArmorSet(Item head, Item body, Items legs)
{
return body.type == mod.ItemType("NaturalRobe") && legs.type = null;
}

public override void UpdateArmorSet(Player player)
{
player.summonKnockback *= 1.20F;
}

public override void UpdateEquip(Player player)
{
player.moveSpeed += 0.05F;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "EssenseOfGaia", 2);
recipe.AddIngredient(null, "Wood", 15);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
I don't know if this is the problem, but you have
Code:
return body.type == mod.ItemType("NaturalRobe") && legs.type = null;
where you should probably have
Code:
return body.type == mod.ItemType("NaturalRobe") && legs.type == null; //<--- forgot to use an extra =
I've made the same mistake myself many times.
 
I made a weapon and used the skeleton mod generator, and after i put the mod in sources and build it i get this error :

Missing mod: ExampleMod/Items/Weapons/ExampleSword
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)


What is causing this?
 
I made a weapon and used the skeleton mod generator, and after i put the mod in sources and build it i get this error :

Missing mod: ExampleMod/Items/Weapons/ExampleSword
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)


What is causing this?
You're missing a texture. You need a png image with the same name as the class that's in the same directory as the cs file.
 
Basically it says that random empty chests are fixed......When I randomly (Happens around every 5th time I run terraria) start terraria with tmod loader and a few mods installed this happens: my setting are all set to default (resolution is back to default and its on windowed for some reason) I start my world and terraria crashes,and When I load up my world again all modded placed block and all modded items in chests are gone. surprisingly all my items in the safe and piggybank are still there, also when the game crashes it deletes the worlds and I find them in the recycling bin and replaces the worlds, Im assuming the replaced world have all modded items removed.

This has happened to me for the 6th time now this year (since 8 days ago :D)

2 of those 6 worlds instead of the game crashing the world just went corrupt.
Mods list:
Zoaklen mod
Thorium mod
calamity mod
reduced grinding
imk sushi mod
wing slot mod
endless items mod
What mod is this from? mod
shorter respawn mod
recipe browser mod

All are up to date,
Please help me, Thanks
 
Basically it says that random empty chests are fixed......When I randomly (Happens around every 5th time I run terraria) start terraria with tmod loader and a few mods installed this happens: my setting are all set to default (resolution is back to default and its on windowed for some reason) I start my world and terraria crashes,and When I load up my world again all modded placed block and all modded items in chests are gone. surprisingly all my items in the safe and piggybank are still there, also when the game crashes it deletes the worlds and I find them in the recycling bin and replaces the worlds, Im assuming the replaced world have all modded items removed.

This has happened to me for the 6th time now this year (since 8 days ago :D)

2 of those 6 worlds instead of the game crashing the world just went corrupt.
Mods list:
Zoaklen mod
Thorium mod
calamity mod
reduced grinding
imk sushi mod
wing slot mod
endless items mod
What mod is this from? mod
shorter respawn mod
recipe browser mod

All are up to date,
Please help me, Thanks
I have all those mods except for shorter respawn time and I don't have your problem. It really sounds like your tModLoader is corrupt, or perhaps has a virus. I would try reinstalling the latest version of tModLoader.
 
I have all those mods except for shorter respawn time and I don't have your problem. It really sounds like your tModLoader is corrupt, or perhaps has a virus. I would try reinstalling the latest version of tModLoader.

I think Ill reinstall the entire game because Ive lost 70 hours of gameplay and I dont feel like losing anymore.
 
I have all those mods except for shorter respawn time and I don't have your problem. It really sounds like your tModLoader is corrupt, or perhaps has a virus. I would try reinstalling the latest version of tModLoader.

By the way this is the error message I get everytime:
Index was outside the bounds of the array.
at Terraria.Player.Spawn()
at Terraria.WorldGen.do_playWorldCallBack(Object threadContext)
at Terraria.WorldGen.playWorldCallBack(Object threadContext)

It doesnt look like anything from a mod so I guees my tmodloader is corrupt afterall :p
 
I have the texture in the same directory, with the same name. It is saying "Missing Mod" , noit "Missing Texture"
Yes, that specific error means that it can't find the texture, hence the line Terraria.ModLoader.ModLoader.GetTexture(String name). Maybe you made a spelling mistake or something. It would be easier to figure out if you posted your code.
 
Is there a way to partially display the player skin under armor? Eg if the 'arms' texture only consists of shoulder pieces then it shows the players arm rather than the arm being invisible
 
Can someone tell me what this error means
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad) ?

I can provide the code if needed.
 
Can someone tell me what this error means
Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at Terraria.ModLoader.AssemblyManager.InstantiateMods(List`1 modsToLoad) ?

I can provide the code if needed.
means you don't have a mod class, something like

Code:
namespace HelpfulHotkeys
{
    public class HelpfulHotkeys : Mod
    {
        public HelpfulHotkeys()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
            };
        }
   }
}
 
means you don't have a mod class, something like

Code:
namespace HelpfulHotkeys
{
    public class HelpfulHotkeys : Mod
    {
        public HelpfulHotkeys()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
            };
        }
   }
}

Ok??? i don't understand...

This is my code
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace WormholeCoins.Items
{
    public class WormholeCoin : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Wormhole Coin";
            item.width = 20;
            item.height = 20;
            item.maxStack = 999;
            item.value = 0;
            item.rare = 1;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.SilverCoin, 20);
            recipe.SetResult(this, 1);
            recipe.AddRecipe();
            recipe = new ModRecipe(mod);
            recipe.AddIngredient(this);
            recipe.SetResult(ItemID.WormholePotion, 1);
            recipe.AddRecipe();
        }
    }
}
 
Ok??? i don't understand...

This is my code
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace WormholeCoins.Items
{
    public class WormholeCoin : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Wormhole Coin";
            item.width = 20;
            item.height = 20;
            item.maxStack = 999;
            item.value = 0;
            item.rare = 1;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.SilverCoin, 20);
            recipe.SetResult(this, 1);
            recipe.AddRecipe();
            recipe = new ModRecipe(mod);
            recipe.AddIngredient(this);
            recipe.SetResult(ItemID.WormholePotion, 1);
            recipe.AddRecipe();
        }
    }
}
Yeah, that's just an item. You need a Mod class, it is the heart of a mod.
 
And what would those be?

Basically what Jopojelly wants you to do is make a new file with the code he gave you previously inside your mod file. This file will act as he said, "The Heart of your Mod". You can't have a mod without this file because the file tells tModLoader that that folder is a mod. Without that file, you cannot compile the folder with tModLoader since it isn't recognized as a mod. If this is not the case, then I suggest you give us a screenshot of inside your mod location (the folder for your mod).

Also you shouldn't post empty posts with just a quote.
 
Basically what Jopojelly wants you to do is make a new file with the code he gave you previously inside your mod file. This file will act as he said, "The Heart of your Mod". You can't have a mod without this file because the file tells tModLoader that that folder is a mod. Without that file, you cannot compile the folder with tModLoader since it isn't recognized as a mod. If this is not the case, then I suggest you give us a screenshot of inside your mod location (the folder for your mod).

Also you shouldn't post empty posts with just a quote.

Srry, i went to edit it right after i saw that it didnt put my msg in
 
Back
Top Bottom