Error cs0246 the type or namespace could not be found

KamenRiderFaiz

Terrarian
I am trying to make a weapon that shoots a custom projectile and it is saying that it cannot be found? code for both weapon and project below
weapon code:

Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Testmod.Content.Projectiles;


namespace Testmod.Content.Items
{
    public class VenomLance : ModItem
    {
        public override void SetDefaults()
        {
            Item.rare = ItemRarityID.Pink;
            Item.value = Item.sellPrice(silver: 5);
            Item.useStyle = ItemUseStyleID.Swing;
            Item.useAnimation = 25;
            Item.useTime = 25;
            Item.UseSound = SoundID.Item1;
            Item.autoReuse = true;
            Item.damage = 33;
            Item.knockBack = 5f;
            Item.noUseGraphic = true; // The item should not be visible when used
            Item.noMelee = true; // The projectile will do the damage and not the item
            Item.DamageType = DamageClass.Ranged;
            Item.shootSpeed = 12f;
            Item.shoot = ModContent.ProjectileType<VenomLanceThrow>();
        }
    
        public override void AddRecipes()
        {
            Recipe recipe = CreateRecipe();
            recipe.AddIngredient(ItemID.DirtBlock, 10);
            recipe.AddTile(TileID.WorkBenches);
            recipe.Register();
        }
    }
}
Projectile Code:
Code:
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using Testmod.Content.Items;

namespace Testmod.Content.Projectiles
{
    public class VenomLanceThrow : ModProjectile
    {
        public bool IsStickingToTarget {
            get => Projectile.ai[0] == 1f;
            set => Projectile.ai[0] = value ? 1f : 0f;
        }
        public int TargetWhoAmI {
            get => (int)Projectile.ai[1];
            set => Projectile.ai[1] = value;
        }
        public int GravityDelayTimer {
            get => (int)Projectile.ai[2];
            set => Projectile.ai[2] = value;
        }

        public float StickTimer {
            get => Projectile.localAI[0];
            set => Projectile.localAI[0] = value;
        }

        public override void SetStaticDefaults() {
            ProjectileID.Sets.DontAttachHideToAlpha[Type] = true;
        }

        public override void SetDefaults() {
            Projectile.width = 16; // The width of projectile hitbox
            Projectile.height = 16; // The height of projectile hitbox
            Projectile.aiStyle = 0;
            Projectile.friendly = true; // Can the projectile deal damage to enemies?
            Projectile.hostile = false; // Can the projectile deal damage to the player?
            Projectile.DamageType = DamageClass.Ranged;
            Projectile.penetrate = 2; // How many monsters the projectile can penetrate.
            Projectile.timeLeft = 600; // The live time for the projectile (60 = 1 second, so 600 is 10 seconds)
            Projectile.light = 0.5f; // How much light emit around the projectile
            Projectile.ignoreWater = true; // Does the projectile's speed be influenced by water?
            Projectile.tileCollide = true; // Can the projectile collide with tiles?
            Projectile.hide = true;
        }
        private const int GravityDelay = 45;

        public override void AI() {
            private const int GravityDelay = 45;

        public override void AI() {

            GravityDelayTimer++;
            if (GravityDelayTimer >= GravityDelay) {
                GravityDelayTimer = GravityDelay;
            }
            Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90f);

            target.AddBuff(BuffID.Venom,30 * 60);
            target.AddBuff(BuffID.Ichor,30 * 60);
        }

    }
}
Anyone know whats happening and how to fix??
the project is in the correct folder as listed in the namespace and i have another projectile in the same folder that works perfectly fine so i don't know what could be wrong
EDIT: Never mind turns out my projectile code wasn't in the correct file type i have fixed it now
 
Last edited:
Back
Top Bottom