@Override
public boolean attackEntityFrom(@Nonnull DamageSource source, float amount) {
if (!isEntityInvulnerable(source) && super.attackEntityFrom(source, amount)) {
if (source instanceof EntityDamageSource && source.getTrueSource() instanceof EntityPlayer
&& SwordHandler.isEquippedAndPowered((EntityPlayer) source.getTrueSource(), DarkSteelConfig.darkSteelSwordPowerUsePerHit)) {
return true;
}
if (rand.nextFloat() < ZooConfig.defendTeleportChance.get()) {
RandomTeleportUtil.teleportEntity(world, this, false, true, ZooConfig.defendTeleportDistance.get());
getNavigator().clearPath();
}
return true;
}
return false;
}