Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello, I have a problem, and since I am a beginner, I know close to nothing about this subject, I am trying to make a mod for Terraria 1.3.5, here are the scripts:

C#
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace op_weapons.Items
{
    public class TrueHell : ModItem
    {
        public override void SetDefaults()
        {
            Item.name = "Omega Eye";
            Item.maxStack = 999;
            Item.Width = 40;
            Item.height = 40;
            Item.value = 1230000;
            Addtooltip("The legendary item");
        }

        public override void AddRecipe()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.GrayBrick);
            recipe.SetResult(this, 2);
            recipe.AddRecepie();
        }
    }
}


the new error is:

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(12,18) : error CS0117: 'Terraria.Item' does not contain a definition for 'name'

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(13,13) : error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.Item.maxStack'

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(14,18) : error CS0117: 'Terraria.Item' does not contain a definition for 'Width'

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(15,13) : error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.Entity.height'

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(16,13) : error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.Item.value'

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(17,13) : error CS0103: The name 'Addtooltip' does not exist in the current context

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(23,20) : error CS1061: 'op_weapons.Items.ModRecipe' does not contain a definition for 'AddIngredient' and no extension method 'AddIngredient' accepting a first argument of type 'op_weapons.Items.ModRecipe' could be found (are you missing a using directive or an assembly reference?)

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(24,20) : error CS1061: 'op_weapons.Items.ModRecipe' does not contain a definition for 'SetResult' and no extension method 'SetResult' accepting a first argument of type 'op_weapons.Items.ModRecipe' could be found (are you missing a using directive or an assembly reference?)

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(25,13) : error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

c:\Users\chedl\Documents\My Games\Terraria\ModLoader\Mod sources\op weapons\Items\TrueHell.cs(25,20) : error CS1061: 'op_weapons.Items.ModRecipe' does not contain a definition for 'AddRecipe' and no extension method 'AddRecipe' accepting a first argument of type 'op_weapons.Items.ModRecipe' could be found (are you missing a using directive or an assembly reference?)

What I have tried:

I have tried changing the name, changing the recipe, changing the texture, changing the name of the mod, I have watched multiple videos on how to fix it, but none of them worked.
Posted
Updated 25-Jul-20 8:22am
v5

That looks like a spelling mistake :) It's AddRecipe / AddRecipes.

public override void AddRecipes()
{
    ModRecipe recipe = new ModRecipe(mod);
    recipe.AddIngredient(ItemID.GrayBrick);
    recipe.SetResult(this, 2);
    recipe.AddRecipe();
}
 
Share this answer
 
v3
Comments
OriginalGriff 13-Jun-18 12:37pm    
I dunno - I could eat a rece pie right now!
Member 13871461 13-Jun-18 13:25pm    
hahaha, I started this morning. and i only know this code...
Member 13871461 13-Jun-18 13:27pm    
oh, and it is not a spelling mistake.
[no name] 13-Jun-18 13:28pm    
public override void AddRecepies() <- This should be AddRecipes
recipe.AddRecepie(); <- This should be AddRecipe
Member 13871461 13-Jun-18 13:33pm    
thank you for helping me for that, but, new problem,also sorry for using your time, i'm not even in highscool
1 error solution:

C#
public override void SetStaticDefaults()
		{
			DisplayName.SetDefault("Rotating Stick");
			Tooltip.SetDefault("Spinning go brrr");
		}


example:

C#
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
 
namespace LatormRage.Items.LatormMatter 
{
    public class Item_a : ModItem
    {
		public override void SetStaticDefaults()
		{
			DisplayName.SetDefault("Rotating Stick");
			Tooltip.SetDefault("Spinning go brrr");
		}
         public override void SetDefaults()
        {
            item.damage = 10;
            item.melee = true;
            item.width = 138;
            item.height = 140;
            item.useTime = 10; 
            item.useAnimation = 10;
            item.channel = true;
            item.useStyle = 100;
            item.knockBack = 3; 
            item.value = Item.sellPrice(0, 5, 0, 0);
            item.rare = 3;                   
            item.shoot = mod.ProjectileType("Projectile4"); 
            item.noUseGraphic = true;
        }
        public override bool UseItemFrame(Player player)
        {
            player.bodyFrame.Y = 3 * player.bodyFrame.Height;
            return true;
        }
    }
}


2 error solution:

change Terraria.Item.maxStack for: item.maxStack = quantity here;

example:

C#
using Terraria.ID;
using Terraria.ModLoader;

namespace LatormRage.Items
{
	public class LatormSoul : ModItem
	{
		public override void SetStaticDefaults()
		{
			DisplayName.SetDefault("Latorm Soul");
			Tooltip.SetDefault("HardMode ingot");
		}
		public override void SetDefaults()
		{
			item.width = 30;
			item.height = 24;
			item.maxStack = 999;
			item.value = 1000;
			item.rare = 4;
			ItemID.Sets.ItemNoGravity[item.type] = true;
		}
	}
}


3 error solution:

terraria.item.width = item.width = 30; (just erase "terraria." in every code line of your code)

4 error solution:

change Terraria.Entity.height for terraia.item.height = 24;

example:

C#
using Terraria.ID;
using Terraria.ModLoader;

namespace LatormRage.Items
{
	public class LatormSoul : ModItem
	{
		public override void SetStaticDefaults()
		{
			DisplayName.SetDefault("Latorm Soul");
			Tooltip.SetDefault("HardMode ingot");
		}
		public override void SetDefaults()
		{
			item.width = 30;
			item.height = 24;
			item.maxStack = 999;
			item.value = 1000;
			item.rare = 4;
			ItemID.Sets.ItemNoGravity[item.type] = true;
		}
	}
}

5 error solution:

change terraria.item.value for item.value = 1000;

6 error solution:

C#
public override void SetStaticDefaults()
		{
			DisplayName.SetDefault("Rotating Stick");
			Tooltip.SetDefault("Spinning go brrr");
		}


example:

C#
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
 
namespace LatormRage.Items.LatormMatter 
{
    public class Item_a : ModItem
    {
		public override void SetStaticDefaults()
		{
			DisplayName.SetDefault("Rotating Stick");
			Tooltip.SetDefault("Spinning go brrr");
		}
         public override void SetDefaults()
        {
            item.damage = 10;
            item.melee = true;
            item.width = 138;
            item.height = 140;
            item.useTime = 10; 
            item.useAnimation = 10;
            item.channel = true;
            item.useStyle = 100;
            item.knockBack = 3; 
            item.value = Item.sellPrice(0, 5, 0, 0);
            item.rare = 3;                   
            item.shoot = mod.ProjectileType("Projectile4"); 
            item.noUseGraphic = true;
        }
        public override bool UseItemFrame(Player player)
        {
            player.bodyFrame.Y = 3 * player.bodyFrame.Height;
            return true;
        }
    }
}


solution for all:

change your code to this:

C++
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace op_weapons.Items
{
    public class TrueHell : ModItem
    {
	public override void SetStaticDefaults() {

          DisplayName.SetDefault(Omega Eye");
          Tooltip.SetDefault("The legendary item");

        }
        public override void SetDefaults()
        {
            Item.maxStack = 999;
            Item.Width = 40;
            Item.height = 40;
            Item.value = 1230000;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 1);
            recipe.AddTile(TileID.Anvils);
            recipe.SetResult(this, 2);
            recipe.AddRecipe();
        }
    }


and not write the [BadInsult] code.
 
Share this answer
 
v3
Comments
Dave Kreskowiak 25-Jul-20 16:39pm    
I seriously doubt the OP is still looking for a solution 2 years later.

Basically, the problem came down to not understanding that C# is case-sensitive and spelling mistakes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900