Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
When i try to enable my terraria mod and launch the mod i get this error mod from terraria. The tutorial i followed was 1 years old but it got a update video from 1 month ago, visual studio shows no errors or warning, this error message only appears when i try to launch the mod. The tutorial i used was
v2023.4.20.0 FIXES - HOW TO MAKE A MOD - TMODLOADER 1.4 - MIGRATION (1)
by Lynx.(I followed his 1 year old one which this one is the update for). My question is how do i fix this terraria issue?

 ---> Terraria.ModLoader.Exceptions.MissingResourceException: Expected resource not found:
    Content/Items/TutorialItem
Closest guess: (Is there a spelling or folder placement error?)
    Content/Items/Weapons/TutorialSword
Content/Items/[c/00ff00:Weapons/]Tutorial[c/00ff00:S][c/ffff00:Item]
Content/Items/        Tutorial [c/ffff00:word]

   --- End of inner exception stack trace ---
   at Terraria.ModLoader.Mod.TransferAllAssets() in tModLoader\Terraria\ModLoader\Mod.Internals.cs:line 103
   at Terraria.ModLoader.ModContent.<>c.<Load>b__42_2(Mod mod) in tModLoader\Terraria\ModLoader\ModContent.cs:line 310
   at Terraria.ModLoader.ModContent.LoadModContent(CancellationToken token, Action`1 loadAction) in tModLoader\Terraria\ModLoader\ModContent.cs:line 368
   at Terraria.ModLoader.ModContent.Load(CancellationToken token) in tModLoader\Terraria\ModLoader\ModContent.cs:line 307
   at Terraria.ModLoader.ModLoader.Load(CancellationToken token) in tModLoader\Terraria\ModLoader\ModLoader.cs:line 127
 ---> (Inner Exception #1) Terraria.ModLoader.Exceptions.MissingResourceException: Failed to load asset: "Content/Items/Weapons/TutorialSword"
System.InvalidOperationException: Texture2D creation failed! Error Code: The parameter is incorrect. (0x80070057)
   at Microsoft.Xna.Framework.FNALoggerEXT.FNA3DLogError(IntPtr msg) in D:\a\tModLoader\tModLoader\FNA\src\FNALoggerEXT.cs:line 98
   at Microsoft.Xna.Framework.Graphics.FNA3D_Impl.FNA3D_CreateTexture2D(IntPtr device, SurfaceFormat format, Int32 width, Int32 height, Int32 levelCount, Byte isRenderTarget)
   at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Int32 width, Int32 height, Boolean mipMap, SurfaceFormat format) in D:\a\tModLoader\tModLoader\FNA\src\Graphics\Texture2D.cs:line 68
   at ReLogic.Content.Readers.PngReader.FromStream[T](Stream stream, MainThreadCreationContext mainThreadCtx) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\Readers\PngReader.cs:line 61
   at ReLogic.Content.AssetRepository.LoadAssetWithPotentialAsync[T](Asset`1 asset, AssetRequestMode mode) in D:\a\tModLoader\tModLoader\src\tModLoader\ReLogic\Content\AssetRepository.cs:line 248<---

 [.NET ThreadPool Worker/INFO] [tML]: Disabling Mod: TutorialMod
 [Main Thread/DEBUG] [tML]: Process.Start (UseShellExecute = True): "tModLoader-Logs" 


this is the code is used for [TutorialItem]

using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.GameContent.Creative;

namespace TutorialMod.Content.Items
{
    internal class TutorialItem : ModItem
    {
        public override void SetStaticDefaults()
        {
            // This accesses the creative catalog
            //Setting the research number to 100 before it can fully accessed
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 100;
        }



        public override void SetDefaults()
        {
           Item.width = 16;    // Hitbox Width from Bottom Center
           Item.height = 16;    // Hitbox Height from Bottom Center

           Item.value = Item.buyPrice(copper: 5);    // Value of the Item 120 = Silver; 1, Copper; 20
            Item.maxStack = 999;
        }

    }
}



The code i used for tutorial sword is


using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.GameContent.Creative;

namespace TutorialMod.Content.Items.Weapons
{
    internal class TutorialSword : ModItem
    {
        public override void SetDefaults()
        { 
            CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
        }

        public override void SetStaticDefaults()
        {
        
            // Hitbox
            Item.width = 32;
            Item.height = 32;
            
            // Use and Animation Style
            Item.useStyle = ItemUseStyleID.Swing;
            Item.useTime = 20;
            Item.useAnimation = 20;
            Item.autoReuse = true;

            //Damage Values
            Item.DamageType = DamageClass.Melee;
            Item.damage = 35;
            Item.knockBack = 3.5f;
            Item.crit = 10;

            //Misc
            Item.value = Item.buyPrice(silver: 80, copper: 50);
            Item.rare = ItemRarityID.Blue;

            //Sound
            Item.UseSound = SoundID.Item1;
        }

        public override void AddRecipes()
        {
            CreateRecipe()
                .AddIngredient(ModContent.ItemType<TutorialItem>() , 8)  // AddIngredient takes ItemID, then Quantity
                .AddTile(TileID.Anvils)  // AddTile takes the TileID
                .Register();  // Register registers the item
        }
    }

}


If u require more information please tell me what type/part u need and ill try to find and add it.

What I have tried:

Ive tried deleting and rewriting areas but this is my first project so my knowledge on what to do is lacking, and i cant find any videos which can guide me.
Posted
Updated 31-May-23 4:00am
v5
Comments
Dave Kreskowiak 30-May-23 22:30pm    
You're going to have to go back to where you got the tutorial from. As a side, the XNA Framework your tutorial is using has been dead for, what, 12 years now? You're following a really OLD tutorial.
Nithpig 31-May-23 9:49am    
i updated the question and put the tutorial in the question near the top
Dave Kreskowiak 31-May-23 13:40pm    
You misunderstand. You have to go talk to the person who wrote the tutorial.

1 solution

This is not a good question - we cannot work out from that little what you are trying to do. Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.

There is nowhere near enough information here for us to begin to help you - we have no idea what you are trying to do, or where you are starting from.

Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?

That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!

Start here: Asking questions is a skill[^] and think about what you need to know, and what you need to tell us in order to get help.
 
Share this answer
 

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