If have written code for an item that should give it more damage when held. However, this only works when swapping off of the item, putting my mouse on the tooltip, or dropping the item on the ground. Here is the code:
public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlot slot, ItemStack stack) {
Multimap<Attribute, AttributeModifier> multimap = super.getAttributeModifiers(slot, stack);
ListMultimap<Attribute, AttributeModifier> mutableMultimap = toMutableMultimap(multimap);
if (slot == EquipmentSlot.MAINHAND) {
mutableMultimap.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "ATTACK_DAMAGE_MODIFIER", Integer.MAX_VALUE, AttributeModifier.Operation.ADDITION));
}