tModLoader An item in my mod crashes TModLoader

Totalniak

Terrarian
So I'm making a mod...
Right now I'm making a boss. However, the summon item crashes whole TMod when i try to reload the mod (it builds correctly)
Here's the code:

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Moddd.Items
{
public class ItemName : ModItem
{
public override void SetDefaults()
{
DisplayName.SetDefault("summon item");
Tooltip.SetDefault("guess what, it summons things!");
item.width = 20;
item.height = 20;
item.maxStack = 999;
item.value = 100;
item.rare = 1;
item.useAnimation = 30;
item.useTime = 30;
item.useStyle = 4;
item.consumable = true;
}
public override bool CanUseItem(Player player)
{
return !NPC.AnyNPCs(mod.NPCType("BossName")); //you can't spawn this boss multiple times
return !Main.dayTime; //can use only at night
}
public override bool UseItem(Player player)
{
NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BossName")); //boss spawn
Main.PlaySound(SoundID.Roar, player.position, 0);
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(TileID.MythrilAnvil);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}




Yeah, help is really appreciated! I'm new to this so please don't get annoyed if the issue is simple.
Thanks!
 
Back
Top Bottom