Cant add ANY items to my mod

mintchipthecoder

Terrarian
Im not able to add any items to my mod even though i have the code and sprites
the code for one of my items looks like this btw
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace sillymod21.Content.Items
{
public class MelonSword : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Melon Sword");
Tooltip.SetDefault("A sword forged from melonium, shoots out a terra blade projectile.");
}

public override void SetDefaults()
{
Item.damage = 145; // Set the sword's damage
Item.DamageType = DamageClass.Melee; // This is a melee weapon
Item.width = 40; // Hitbox width
Item.height = 40; // Hitbox height
Item.useTime = 10; // How fast the weapon is used
Item.useAnimation = 10; // How fast the animation plays
Item.useStyle = ItemUseStyleID.Swing; // The style of the weapon
Item.knockBack = 6; // Knockback power
Item.value = Item.sellPrice(gold: 10); // Item value
Item.rare = ItemRarityID.Green; // Rarity
Item.UseSound = SoundID.Item1; // Sound when used
Item.autoReuse = true; // Automatically swing the sword
Item.shoot = ProjectileID.TerraBeam; // Shoots the Terra Blade projectile
Item.shootSpeed = 10f; // Speed of the projectile
}

public override void AddRecipes()
{
Recipe recipe = CreateRecipe();
recipe.AddIngredient(ModContent.ItemType<Materials.Melonium>(), 10); // Requires 10 Melonium
recipe.AddTile(TileID.Anvils); // Crafted at an anvil
recipe.Register();
}
}
}
 
To be clear, are you experiencing an error when building your mod or just it not working?
 
To be clear, are you experiencing an error when building your mod or just it not working?
theres no problem building it but when i open up a world neither cheat sheet or recipe browser has them even though im pretty sure they should auto load into them
 
If you're on the current version of TML, it shouldn't build as

DisplayName.SetDefault("Melon Sword");
Tooltip.SetDefault("A sword forged from melonium, shoots out a terra blade projectile.");

This is no longer valid code, display name and tooltip are set in the localization files now instead.
 
If you're on the current version of TML, it shouldn't build as

DisplayName.SetDefault("Melon Sword");
Tooltip.SetDefault("A sword forged from melonium, shoots out a terra blade projectile.");

This is no longer valid code, display name and tooltip are set in the localization files now instead.
ill see if it works
 
If you're on the current version of TML, it shouldn't build as

DisplayName.SetDefault("Melon Sword");
Tooltip.SetDefault("A sword forged from melonium, shoots out a terra blade projectile.");

This is no longer valid code, display name and tooltip are set in the localization files now instead.
might need assistance with what to add because im a little confused its my first time modding
 
Delete those two lines, for DisplayName and Tooltip. Then go into TML and build your mod. It'll generate the localization files for you.
 
Back
Top Bottom