attack

public void attack(LivingEntity target)

This is the preferred way to attack a living entity if you have a living entity as the underlying entity. It will simulate a real attack using Minecraft's damage system. If you do not have a living entity as the underlying entity, it will default to doing 1 damage to the target, and at that point, you should use attack instead.


public void attack(LivingEntity target, double damage)

Beware, this damage uses custom damage which might get reduced somewhat randomly by Minecraft, so test it before using it. Preferably, you should use attack instead, and if you need to modify the damage, you can hijack the damage event and modify the damage amount.

Parameters

target

Target to attack

damage

Damage to deal