Try ProjectileID since ItemID and projectileID both return integers they are kind of compartible.
Edit 1:I looked it up and I didn't find a heart projectile. Maybe I'll find a workaround.
Edit 2:I got an idea how it could work, but I couldn't test it because I need a 1.17.1 compiler but can only download the 1.17 one

.
This basicly creates a projectile wich when it gets destroyed spawns a heart.
That's the code.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Mod.Projectiles //Change it to the corect folder
{
public class heartproj: ModProjectile
{
public class txtxx : ModProjectile
{
public override void SetDefaults()
{
//projectile.name = "Custom Flamethrower"; //Name of the projectile, only shows this if you get killed by it
projectile.width = 12; //Set the hitbox width
projectile.height = 12; //Set the hitbox height
projectile.hostile = true; //Tells the game whether it is friendly to players/friendly npcs or not
projectile.ignoreWater = true; //Tells the game whether or not projectile will be affected by water
projectile.ranged = true; //Tells the game whether it is a ranged projectile or not
projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed, -1 infinity
projectile.timeLeft = 600; //The amount of time the projectile is alive for
}
public override void Kill(int timeLeft) {
Item.NewItem(projectile.position,ItemID.Heart,1);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
projectile.Kill();
return false;
}
}
}
}
Just remember to spawn it using:
Code:
item.shoot = mod.ProjectileType("heartproj");
Edit 3:
Now the code is right!