It is an API function that gets called when an entity is hurt. You usually don't want to use it. Edit: if you want to make an entity hurt, yes. But make sure the source is a constant from EntityDamageEvent.php or an EntityDamageEvent instance, or just let it use the default value. $damage is the number of half hearts dealt.