Hi!
I'm new to modding and the mod I'm creating has a weapon which attacks specific entities with more damage. I overrided the hitEntity() function from SwordItem and the damage stuff works fine, but the sword's durability does not go down. I found this damageItem() function, but whatever I pass into this it does not work. Here is the unfinished code:
@Override
public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker){
if(target instanceof ZombieEntity || target instanceof SkeletonEntity || target instanceof HuskEntity || target instanceof StrayEntity){
target.attackEntityFrom(DamageSource.GENERIC, getAttackDamage() + 5);
}else{
target.attackEntityFrom(DamageSource.GENERIC, getAttackDamage() + 1);
}
damageItem(stack, 1, )
return true;
}