So, this is perhaps a deceptively simple question, but is there any way to have an item deal damage WITHOUT extending the tool or sword classes? I'm trying to make a rock which can be placed as a block, thrown like snowball, or used as a melee weapon. I cant seem to figure out he melee part though.
Note that ItemSword and ItemTool don't actually deal damage to the attacked entity in Item#hitEntity, they only damage the ItemStack.
What makes them effective as melee weapons is the fact that they apply an attribute modifier to the attack damage and attack speed attributes by overriding Item#getItemAttributeModifiers. In your own Item class, you should override the Forge-added Item#getAttributeModifiers method instead.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.