tModLoader [FIXED] Object reference not set to an instance of an object

Embers23

Official Terrarian
i cannot find any documentation on how to fix this other than basically "fix your code lol"
in short whenever i mouse over my item there's no name or tooltip and i get the post name error
C#:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;

namespace EmberMod.Items.Accessories
{
    public class FragmentedSoul : ModItem
    {
        public override void SetDefaults()
        {
            Item.width = 30;
            Item.height = 30;
            Item.rare = 13;
            Item.accessory = true;
            Main.RegisterItemAnimation(Type, new DrawAnimationVertical(6, 4));
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.statLifeMax2 /= 3;
            player.statDefense *=0;
            player.GetCritChance(DamageClass.Generic) += 50f;
            player.GetDamage(DamageClass.Generic) *= 2f;
        }
        public override void AddRecipes()
        {
                Recipe recipe = CreateRecipe();
                recipe.AddIngredient(ItemID.DemoniteBar, 10);
                recipe.AddIngredient(ItemID.Amethyst, 5);
                recipe.AddIngredient(ItemID.Topaz, 5);
                recipe.AddIngredient(ItemID.Sapphire, 5);
                recipe.AddIngredient(ItemID.Emerald, 5);
                recipe.AddIngredient(ItemID.Ruby, 5);
                recipe.AddIngredient(ItemID.Amber, 5);
                recipe.AddIngredient(ItemID.Diamond, 5);
                recipe.AddTile(TileID.DemonAltar);
                recipe.Register();
            }
      }
}
if no one finds out fix this ill just try and remake the item
 
I don't know if this is the issue, but 13 isn't a rarity according to the Terraria wiki. Maybe try using -13, as that's the closest rarity.
 
Last edited:
Back
Top Bottom