PC I wrote this code (am begginner) and it didnt work ;( help

.T

Terrarian
C#:
using Terraria;
using Terraria.ID;
using Microsoft.Xna.Framework;
using ASuperElasticBouncySmallBouncyInvisibleBossMod;

namespace ASuperElasticBouncySmallBouncyInvisibleBossMod.ASuperElasticBouncySmallBouncyInvisibleBoss.Content.Items.Weapons

{
    public class SEBSIB : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("'This Sword is basically impossible to get'");
        }

        public override void SetDefaults()
        {
            item.width = 20 + 0;
            item.height = 32 + 0;
            item.melee = true;
            item.name = "The Super Elastic Bouncy Small Invisible Boss Sword";
            item.damage = 1 + 0;
            item.UseTime = 20;
            item.rare = 3;
            item.UseStyle = 20;
            item.value = 0;
            item.useSound = 7;
            item.autoReuse = false;
            item.knockBack = 0;
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            object p = recipe.AddIngredient(ModItem.EsscenseOfTheSuperElasticBouncySmallInvisibleBoss, 10); // add the LocalIngredient im pretty sure
            object p1 = recipe.AddTile(TileID.OrichcalcumAnvils); // add local twice
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }

}

I spelled the namespace wrong when i was making the mod

"An error ocurred while building ASuperElasticBouncySmallBouncyInvisibleBossMod
Compiling ASuperElasticBouncySmallBouncyInvisibleBossMod.XNA.dll failed with 24 errors and 0 warnings
Error: c:\Users\(UserName\OneDrive\Documents\My Games\Terraria\ModLoader\Mod Sources\ASuperElasticBouncySmallBouncyInvisibleBossMod\ASuperElasticBouncySmallBouncyInvisibleBoss\Content\Items\Weapons\SEBSIB.cs(5,6) : error CS0246 (so obviously a common problem) : The Type or namespace 'ModItem' could not be found (are you missing a directive or an assembly reference?)

So it's 2020, and I'm having this problem like everyone else. In 2017.

Here we go again.

I just want to point out that, my mod name is very long as this was a boss meant to be a kinda, troll boss.
 
Replace your code with this :
C#:
using ASuperElasticBouncySmallBouncyInvisibleBossMod;
using Microsoft.Xna.Framework;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria;

namespace ASuperElasticBouncySmallBouncyInvisibleBossMod.ASuperElasticBouncySmallBouncyInvisibleBoss.Content.Items.Weapons
{
    public class SEBSIB : ModItem
    {
        public override void SetStaticDefaults()
        {
            Tooltip.SetDefault("'This Sword is basically impossible to get'");
            DisplayName.SetDefault("The Super Elastic Bouncy Small Invisible Boss Sword");
        }
        public override void SetDefaults()
        {
            item.width = 20 + 0;
            item.height = 32 + 0;
            item.melee = true;
            item.damage = 1 + 0;
            item.useTime = 20;
            item.rare = 3;
            item.useStyle = 20;
            item.value = 0;
            item.UseSound = new LegacySoundStyle(0,0);
            item.autoReuse = false;
            item.knockBack = 0;
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(new EsscenseOfTheSuperElasticBouncySmallInvisibleBoss(), 10); // add the LocalIngredient im pretty sure
            recipe.AddTile(TileID.MythrilAnvil); // add local twice
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
replace the 0s in "new LegacySoundStyle(0,0)" with the Ids of the sound you want.

But it is recommended to learn the basics of C# before making a mod.
 
Back
Top Bottom