tModLoader Error CS0120 when attempting to add recipe to mod item

MrQuinnzard

Official Terrarian
I'm trying to add a crafting recipe to an item in a mod I'm making, but every time I attempt to compile, I get this error message:
Error: C:/Users/mrqui\Documents\My Games\Terraria\tModLoader\..\tModLoader\ModSources\ToDModdedSqlModThng\Items\TerraStaff.cs(39,4): error CS0120: An object reference is required for the non-static field, method, or property 'ModItem.CreateRecipe(int)'
Here's the item code:
C#:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.GameContent.Creative;
using Terraria.ModLoader;
namespace ToDModdedSqlModThng.Items
{
    public class TerraStaff : ModItem
    {
        public override void SetStaticDefaults() {
            Tooltip.SetDefault("Shoots magic swords");
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
        }
        public override void SetDefaults() {
            Item.damage = 115;
            Item.DamageType = DamageClass.Magic; // Makes the damage register as magic. If your item does not have any damage type, it becomes true damage (which means that damage scalars will not affect it). Be sure to have a damage type.
            Item.width = 34;
            Item.height = 40;
            Item.useTime = 20;
            Item.useAnimation = 20;
            Item.useStyle = ItemUseStyleID.Shoot; // Makes the player use a 'Shoot' use style for the Item.
            Item.noMelee = true; // Makes the item not do damage with it's melee hitbox.
            Item.knockBack = 6;
            Item.value = 10000;
            Item.rare = ItemRarityID.LightRed;
            Item.UseSound = SoundID.Item71;
            Item.autoReuse = true;
            Item.shoot = ProjectileID.TerraBeam; // Shoot a black bolt, also known as the projectile shot from the onyx blaster.
            Item.shootSpeed = 15; // How fast the item shoots the projectile.
            Item.crit = 32; // The percent chance at hitting an enemy with a crit, plus the default amount of 4.
            Item.mana = 11; // This is how much mana the item uses.
        }
        // Please see Content/ExampleRecipes.cs for a detailed explanation of recipe creation.
        public override void AddRecipes() {
            TerraStaff.CreateRecipe();
                TerraStaff.AddIngredient<ItemID.ChlorophyteBar>(10);
                TerraStaff.AddIngredient<ItemID.Sapphire>(5);
                TerraStaff.AddIngredient<ItemID.BrokenHeroSword>(1);
                TerraStaff.AddTile<Tiles.Furniture.Toilet>();
                TerraStaff.Register();
            }
    }
}
 
Here, take a look at the example recipe in here - ExampleItem
Followed that, now I get that error at line 40. Here's the recipe code:


C#:
Recipe.Create(1); { // line 39
                Recipe.AddIngredient(1006, 10); // line 40
                Recipe.AddIngredient(ItemID.Sapphire, 20); // line 41
                AddIngredient(ItemID.BrokenHeroSword, 1); // line 42
                AddTile(TileID.Anvils); // line 43
                Register(); // line 44
 
You are using the wrong 'Recipe', you have to create a recipe object first.
Recipe recipe = Recipe.Create(1);

Then where you have Recipe you should have recipe, like recipe.AddIngredient(1006, 10);
 
Back
Top Bottom