error CS0246 The type or namespace 'List<>' could not be found

Title
I am confused, here is code:


using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TheElementalCollapseMod;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace TheElementalCollapseMod.Items
{
public class RazorGrass : ModItem
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("PieceOfBark"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
Tooltip.SetDefault("A usually quite common species of grass that grows with serrated blades, touched by elemental energy. Shoots a sharp leaf.");
}

public override void SetDefaults()
{
Item.damage = 25;
Item.DamageType = DamageClass.Melee;
Item.width = 40;
Item.height = 40;
Item.useTime = 20;
Item.useAnimation = 20;
Item.useStyle = 1;
Item.knockBack = 10;
Item.value = 100;
Item.rare = 2;
Item.UseSound = SoundID.Item1;
Item.autoReuse = false;
Item.shoot = ModContent.ProjectileType<Projectiles.RazorGrassProjectile>();
Item.shootSpeed = 15f;
}

public override void ModifyTooltips(List<TooltipLine> tooltips)
{
var lineToChange = tooltips.FirstOrDefault(x => x.Name == "Damage" && x.Mod == "Terraria");
if(lineToChange != null)
{
string[] split = lineToChange.Text.Split(' ');
lineToChange.Text = split.First() + " elemental " + split.Last();
}
}

public override void ModifyWeaponDamage(Player player, ref StatModifier damage)
{
damage += player.GetModPlayer<GlobalPlayer>().elementalDamage;
}

public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ItemID.DirtBlock, 100);
recipe.AddIngredient(ItemID.JungleGrassSeeds, 10);
recipe.AddIngredient(ItemID.Wood, 100);
recipe.AddTile(TileID.Anvils);
recipe.Register();
}
}
}
 
You need using System.Linq; for that.

FYI if you set up visual studio 2022 correctly, and always open the .csproj instead of the individual files, it'll be able to recommend these types of fixes to you.
 
You need using System.Linq; for that.

FYI if you set up visual studio 2022 correctly, and always open the .csproj instead of the individual files, it'll be able to recommend these types of fixes to you.
Thanks so much! You've now helped me twice with my mod!
I use visual studio code so there are some small differences
also I'm lazy lol
 
Last edited:
Could Somebody please help me with this?
Please?
Glad you managed to get this sorted - just wanted to let you know that bumping a thread like this is against the forum rules as it doesn't contribute any new content. Next time, you could include things you've tried to get it to work since the original post in your message which would be allowed
 
Back
Top Bottom