"Terraria.ModLoader.Exceptions.MissingResourceException: Expected resource not found" but the resources are right?

Misi

Terrarian
Hello! im having trouble to find where my mistake is, i cant find the reason why my mod seems to be lacking a resource or something.
I think the main problem is happening on the line: "using ElexonPLayStyle.Content.Items.projectiles.Armas;", since it seems that the part: ''projectiles.Armas;'' cannot find the class: "EspadaCortaProyectil" from the code: "EspadaCortaProyectil.cs"

If someone would be interested in helping me i would be so grate full, :D
Also sorry if some words are in Spanish.


C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.GameContent.Creative;
using Terraria.ID;
using ElexonPLayStyle.Content.Items.projectiles.Armas;

namespace ElexonPLayStyle.Content.Items.Armas
{               internal class EspadaCorta: ModItem
    {
        public override void SetStaticDefaults()
        {
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;       
        }

        public override void SetDefaults()
        {
            Item.width = 32;
            Item.height = 32;

            Item.useTime = 12;
            Item.useAnimation = 12;
            Item.useStyle = ItemUseStyleID.Rapier;

            Item.UseSound = SoundID.Item1;

            Item.DamageType = DamageClass.Melee;
            Item.damage = 17;
            Item.knockBack = 4f;

            Item.rare = ItemRarityID.Red;
            Item.value = Item.buyPrice(gold: 20);

            Item.noUseGraphic = true;
            Item.noMelee = true;

            Item.shootSpeed = 2.1f;
            Item.shoot = ModContent.ProjectileType<EspadaCortaProyectil>();

        }
    
    }


}


C#:
using Terraria;
using Terraria.ModLoader;
using Terraria.GameContent.Creative;
using Terraria.ID;
using Microsoft.Xna.Framework;

namespace ElexonPLayStyle.Content.Items.Projectiles.Armas
{
    internal class EspadaCortaProyectil : ModProjectile
    {
        public override void SetDefaults()
        {
            Projectile.width = 24;
            Projectile.height = 24;

            Projectile.friendly = true;
            Projectile.penetrate = -1;
            Projectile.tileCollide = false;
            Projectile.DamageType = DamageClass.Melee;
            Projectile.ownerHitCheck = true;
            Projectile.extraUpdates = 1;
            Projectile.timeLeft = 300;
            Projectile.aiStyle = ProjAIStyleID.ShortSword;

        }

        public override void AI()
        {
            base.AI();
            Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 - MathHelper.PiOver4 * Projectile.spriteDirection;

            int halfProjWidth = Projectile.width / 2;
            int halfProjHeight = Projectile.height / 2;

            DrawOriginOffsetX = 0;
            DrawOffsetX = -((40 / 2) - halfProjWidth);
            DrawOriginOffsetY = -((40 / 2) - halfProjHeight);
        }

    }




}
 

Attachments

  • imagen_2025-05-15_175657260.png
    imagen_2025-05-15_175657260.png
    16.3 KB · Views: 40
You need to capitalize "Projectiles" in the item's using line so it matches the folder name of the projectile.
C#:
using ElexonPLayStyle.Content.Items.projectiles.Armas;
C#:
namespace ElexonPLayStyle.Content.Items.Projectiles.Armas
 
You need to capitalize "Projectiles" in the item's using line so it matches the folder name of the projectile.
C#:
using ElexonPLayStyle.Content.Items.projectiles.Armas;
C#:
namespace ElexonPLayStyle.Content.Items.Projectiles.Armas
i ve fixed that but still the same problem
 
If the problem is that it can't find the projectile, make sure all of the using lines, folders, and namespaces are spelled and capitalized correctly
 
This has been happening for me quite a lot and a simple but unexpected fix is just put it in Content.Items (provided you still have the folder)
 
Is the PNG a valid PNG? Meaning did you save an image as a PNG or did you take another format, like webp, and just rename it?
 
If the problem is that it can't find the projectile, make sure all of the using lines, folders, and namespaces are spelled and capitalized correctly
Btw i finally found the problem! In the code EspadaCorta, on the namespace to indicate the folder that it was using, i forgotted to name the last folder, "Espadas".
So insted of: "namespace ElexonPLayStyle.Content.Items.Armas.Espadas" , it was: "namespace ElexonPLayStyle.Content.Items.Armas"
 
Is the PNG a valid PNG? Meaning did you save an image as a PNG or did you take another format, like webp, and just rename it?
Actually the problem was that i missed an folder when writting the namespace of the code "EspadaCorta.cs"
 
Is the PNG a valid PNG? Meaning did you save an image as a PNG or did you take another format, like webp, and just rename it?
The PNG are fine, its a silly looking sword made on Aseprite
 
Back
Top Bottom