Search in sources :

Example 1 with ICustomAttackSound

use of com.minecolonies.api.entity.ICustomAttackSound in project minecolonies by ldtteam.

the class RaiderRangedAI method doAttack.

@Override
protected void doAttack(final LivingEntity target) {
    user.getNavigation().stop();
    // Setup arrow
    AbstractArrowEntity arrowEntity = CombatUtils.createArrowForShooter(user);
    arrowEntity.setBaseDamage(user.getAttribute(MOB_ATTACK_DAMAGE).getValue());
    if (flightCounter > 5) {
        ((CustomArrowEntity) arrowEntity).setPlayerArmorPierce();
        arrowEntity.setSecondsOnFire(200);
        arrowEntity.setBaseDamage(10);
    }
    if (user.getDifficulty() > ARROW_PIERCE_DIFFICULTY) {
        arrowEntity.setPierceLevel((byte) 2);
    }
    // Shoot arrow
    CombatUtils.shootArrow(arrowEntity, target, 10.0f);
    // Visuals
    user.swing(Hand.MAIN_HAND);
    SoundEvent attackSound = SoundEvents.SKELETON_SHOOT;
    if (arrowEntity instanceof ICustomAttackSound) {
        attackSound = ((ICustomAttackSound) arrowEntity).getAttackSound();
    }
    user.playSound(attackSound, (float) 1.0D, (float) getRandomPitch());
}
Also used : SoundEvent(net.minecraft.util.SoundEvent) ICustomAttackSound(com.minecolonies.api.entity.ICustomAttackSound) CustomArrowEntity(com.minecolonies.coremod.entity.CustomArrowEntity) AbstractArrowEntity(net.minecraft.entity.projectile.AbstractArrowEntity)

Example 2 with ICustomAttackSound

use of com.minecolonies.api.entity.ICustomAttackSound in project minecolonies by Minecolonies.

the class RaiderRangedAI method doAttack.

@Override
protected void doAttack(final LivingEntity target) {
    user.getNavigation().stop();
    // Setup arrow
    AbstractArrowEntity arrowEntity = CombatUtils.createArrowForShooter(user);
    arrowEntity.setBaseDamage(user.getAttribute(MOB_ATTACK_DAMAGE).getValue());
    if (flightCounter > 5) {
        ((CustomArrowEntity) arrowEntity).setPlayerArmorPierce();
        arrowEntity.setSecondsOnFire(200);
        arrowEntity.setBaseDamage(10);
    }
    if (user.getDifficulty() > ARROW_PIERCE_DIFFICULTY) {
        arrowEntity.setPierceLevel((byte) 2);
    }
    // Shoot arrow
    CombatUtils.shootArrow(arrowEntity, target, 10.0f);
    // Visuals
    user.swing(Hand.MAIN_HAND);
    SoundEvent attackSound = SoundEvents.SKELETON_SHOOT;
    if (arrowEntity instanceof ICustomAttackSound) {
        attackSound = ((ICustomAttackSound) arrowEntity).getAttackSound();
    }
    user.playSound(attackSound, (float) 1.0D, (float) getRandomPitch());
}
Also used : SoundEvent(net.minecraft.util.SoundEvent) ICustomAttackSound(com.minecolonies.api.entity.ICustomAttackSound) CustomArrowEntity(com.minecolonies.coremod.entity.CustomArrowEntity) AbstractArrowEntity(net.minecraft.entity.projectile.AbstractArrowEntity)

Aggregations

ICustomAttackSound (com.minecolonies.api.entity.ICustomAttackSound)2 CustomArrowEntity (com.minecolonies.coremod.entity.CustomArrowEntity)2 AbstractArrowEntity (net.minecraft.entity.projectile.AbstractArrowEntity)2 SoundEvent (net.minecraft.util.SoundEvent)2