Search in sources :

Example 1 with ArmorBypassDamageSource

use of omtteam.openmodularturrets.entity.projectiles.damagesources.ArmorBypassDamageSource in project OpenModularTurrets by OpenModularTurretsTeam.

the class FerroSlugProjectile method onHitEntity.

@Override
public void onHitEntity(Entity entity) {
    if (entity != null && !getEntityWorld().isRemote) {
        int damage = ConfigHandler.getRailgunTurretSettings().getDamage();
        if (isAmped) {
            if (entity instanceof EntityLivingBase) {
                EntityLivingBase elb = (EntityLivingBase) entity;
                damage += ((int) elb.getHealth() * (getDamageAmpBonus() * amp_level));
            }
        }
        if (entity instanceof EntityPlayer) {
            if (canDamagePlayer((EntityPlayer) entity)) {
                entity.attackEntityFrom(new ArmorBypassDamageSource("ferroslug"), damage);
                entity.hurtResistantTime = 0;
                playSound();
            } else {
                return;
            }
        } else {
            entity.attackEntityFrom(new ArmorBypassDamageSource("ferroslug"), damage);
            entity.hurtResistantTime = 0;
            playSound();
        }
        setMobDropLoot(entity);
        this.setDead();
    }
}
Also used : ArmorBypassDamageSource(omtteam.openmodularturrets.entity.projectiles.damagesources.ArmorBypassDamageSource) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 2 with ArmorBypassDamageSource

use of omtteam.openmodularturrets.entity.projectiles.damagesources.ArmorBypassDamageSource in project OpenModularTurrets by OpenModularTurretsTeam.

the class GrenadeProjectile method onUpdate.

@Override
public void onUpdate() {
    super.onUpdate();
    if (ticksExisted >= 40) {
        if (!getEntityWorld().isRemote) {
            float strength = ConfigHandler.canGrenadesDestroyBlocks ? 1.4F : 0.1F;
            getEntityWorld().createExplosion(null, posX, posY, posZ, strength, true);
            AxisAlignedBB axis = new AxisAlignedBB(this.posX - 3, this.posY - 3, this.posZ - 3, this.posX + 3, this.posY + 3, this.posZ + 3);
            List<EntityLivingBase> targets = getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, axis);
            for (EntityLivingBase mob : targets) {
                int damage = ConfigHandler.getGrenadeTurretSettings().getDamage();
                if (isAmped) {
                    EntityLivingBase elb = (EntityLivingBase) mob;
                    damage += ((int) elb.getHealth() * (getDamageAmpBonus() * amp_level));
                }
                setMobDropLoot(mob);
                if (mob instanceof EntityPlayer) {
                    if (canDamagePlayer((EntityPlayer) mob)) {
                        mob.attackEntityFrom(new NormalDamageSource("grenade"), damage * 0.9F);
                        mob.attackEntityFrom(new ArmorBypassDamageSource("grenade"), damage * 0.1F);
                        mob.hurtResistantTime = 0;
                    }
                } else {
                    mob.attackEntityFrom(new NormalDamageSource("grenade"), damage * 0.9F);
                    mob.attackEntityFrom(new ArmorBypassDamageSource("grenade"), damage * 0.1F);
                    mob.hurtResistantTime = 0;
                }
            }
            this.setDead();
        }
        for (int i = 0; i <= 20; i++) {
            getEntityWorld().spawnParticle(EnumParticleTypes.REDSTONE, posX, posY, posZ, 1.0D, 1.0D, 1.0D);
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) ArmorBypassDamageSource(omtteam.openmodularturrets.entity.projectiles.damagesources.ArmorBypassDamageSource) EntityLivingBase(net.minecraft.entity.EntityLivingBase) NormalDamageSource(omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Aggregations

EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 ArmorBypassDamageSource (omtteam.openmodularturrets.entity.projectiles.damagesources.ArmorBypassDamageSource)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 NormalDamageSource (omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource)1