use of net.minecraft.entity.boss.EntityDragon in project OpenModularTurrets by OpenModularTurretsTeam.
the class RocketProjectile method onHitEntity.
@Override
public void onHitEntity(Entity entity) {
if (!getEntityWorld().isRemote && !(entity instanceof EntityPlayer && !canDamagePlayer((EntityPlayer) entity))) {
float strength = ConfigHandler.canRocketsDestroyBlocks ? 2.3F : 0.1F;
getEntityWorld().createExplosion(null, posX, posY, posZ, strength, true);
AxisAlignedBB axis = new AxisAlignedBB(this.posX - 5, this.posY - 5, this.posZ - 5, this.posX + 5, this.posY + 5, this.posZ + 5);
List<EntityLivingBase> targets = getEntityWorld().getEntitiesWithinAABB(EntityLivingBase.class, axis);
for (EntityLivingBase mob : targets) {
int damage = ConfigHandler.getRocketTurretSettings().getDamage();
if (isAmped) {
EntityLivingBase elb = (EntityLivingBase) mob;
damage += ((int) elb.getHealth() * (getDamageAmpBonus() * amp_level));
}
if (mob instanceof EntityPlayer) {
if (canDamagePlayer((EntityPlayer) mob)) {
mob.attackEntityFrom(new NormalDamageSource("rocket"), damage);
mob.hurtResistantTime = 0;
}
}
if (ConfigHandler.isCanRocketsHurtEnderDragon() && mob instanceof EntityDragon) {
((EntityDragon) mob).setHealth(((EntityDragon) mob).getHealth() - damage);
mob.hurtResistantTime = 0;
} else {
mob.attackEntityFrom(new NormalDamageSource("rocket"), damage);
mob.hurtResistantTime = 0;
}
setMobDropLoot(mob);
}
this.setDead();
}
}
Aggregations