use of omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource in project OpenModularTurrets by OpenModularTurretsTeam.
the class LaserProjectile method onHitEntity.
@Override
public void onHitEntity(Entity entity) {
if (entity != null && !getEntityWorld().isRemote) {
int damage = ConfigHandler.getLaserTurretSettings().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.setFire(2);
entity.attackEntityFrom(new NormalDamageSource("laser"), damage);
entity.hurtResistantTime = 0;
} else {
return;
}
} else {
entity.setFire(2);
entity.attackEntityFrom(new NormalDamageSource("laser"), damage);
entity.hurtResistantTime = 0;
setMobDropLoot(entity);
}
this.setDead();
}
}
use of omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource in project OpenModularTurrets by OpenModularTurretsTeam.
the class RocketProjectile method onHitBlock.
@Override
@ParametersAreNonnullByDefault
public void onHitBlock(IBlockState hitBlock, BlockPos pos) {
if (hitBlock.getBlock() instanceof BlockAbstractTurretHead) {
return;
}
if (!hitBlock.getMaterial().isSolid()) {
// Go through non solid block
return;
}
if (!getEntityWorld().isRemote) {
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 (Entity mob : targets) {
int damage = ConfigHandler.getRocketTurretSettings().getDamage();
if (isAmped) {
if (mob instanceof EntityLivingBase) {
EntityLivingBase elb = (EntityLivingBase) mob;
damage += ((int) elb.getHealth() * (0.08F * 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;
}
}
}
this.setDead();
}
use of omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource 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();
}
}
use of omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource in project OpenModularTurrets by OpenModularTurretsTeam.
the class BlazingClayProjectile method onHitEntity.
@Override
public void onHitEntity(Entity entity) {
if (!getEntityWorld().isRemote && !(entity instanceof EntityPlayer && !canDamagePlayer((EntityPlayer) entity))) {
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);
int damage = ConfigHandler.getIncendiaryTurretSettings().getDamage();
if (isAmped) {
if (entity instanceof EntityLivingBase) {
EntityLivingBase elb = (EntityLivingBase) entity;
damage += ((int) elb.getHealth() * (getDamageAmpBonus() * amp_level));
}
}
for (EntityLivingBase mob : targets) {
setMobDropLoot(mob);
if (mob instanceof EntityPlayer) {
if (canDamagePlayer((EntityPlayer) mob)) {
mob.attackEntityFrom(new NormalDamageSource("bullet"), damage);
mob.hurtResistantTime = 0;
mob.setFire(5);
}
} else {
mob.attackEntityFrom(new NormalDamageSource("bullet"), damage);
mob.hurtResistantTime = 0;
mob.setFire(5);
}
setMobDropLoot(entity);
}
this.setDead();
}
}
use of omtteam.openmodularturrets.entity.projectiles.damagesources.NormalDamageSource in project OpenModularTurrets by OpenModularTurretsTeam.
the class BlazingClayProjectile method onHitBlock.
@Override
@ParametersAreNonnullByDefault
public void onHitBlock(IBlockState hitBlock, BlockPos pos) {
if (hitBlock.getBlock() instanceof BlockAbstractTurretHead) {
return;
}
if (!hitBlock.getMaterial().isSolid()) {
// Go through non solid block
return;
}
if (!getEntityWorld().isRemote) {
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);
int damage = ConfigHandler.getIncendiaryTurretSettings().getDamage();
for (Entity mob : targets) {
if (mob instanceof EntityPlayer) {
if (canDamagePlayer((EntityPlayer) mob)) {
mob.attackEntityFrom(new NormalDamageSource("bullet"), damage);
mob.hurtResistantTime = 0;
mob.setFire(5);
playSound();
}
} else {
mob.attackEntityFrom(new NormalDamageSource("bullet"), damage);
mob.hurtResistantTime = 0;
mob.setFire(5);
playSound();
}
}
this.setDead();
}
}
Aggregations