use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityEmeraldChunk method onImpact.
@Override
protected void onImpact(MovingObjectPosition movObjPos) {
if (movObjPos.entityHit != null) {
boolean isEnemy = movObjPos.entityHit instanceof EntityClayMan && this.target instanceof EntityClayMan && !((EntityClayMan) movObjPos.entityHit).getClayTeam().equals(((EntityClayMan) this.target).getClayTeam());
DamageSource dmgSrc = DamageSource.causeThrownDamage(this, this.getThrower());
if (this.getThrower() == null) {
dmgSrc = DamageSource.causeThrownDamage(this, this);
}
dmgSrc.setDamageBypassesArmor();
if (movObjPos.entityHit == this.target || isEnemy) {
float attackDmg = 3.0F + this.rand.nextFloat();
if (movObjPos.entityHit.isWet()) {
attackDmg *= 2.0F;
}
if (movObjPos.entityHit.attackEntityFrom(dmgSrc, attackDmg)) {
if (this.getThrower() instanceof EntityClayMan) {
((EntityClayMan) this.getThrower()).onProjectileHit(this, movObjPos);
}
if (movObjPos.entityHit instanceof EntityClayMan) {
EntityClayMan iChun = (EntityClayMan) movObjPos.entityHit;
movObjPos.entityHit.playSound("ambient.weather.thunder", 1.0F, 8.0F);
SoldierEffectInst effect = iChun.addEffect(SoldierEffects.getEffect(SoldierEffects.EFF_THUNDER));
if (effect != null && this.origin != null) {
effect.getNbtTag().setDouble("originX", this.origin.getValue0());
effect.getNbtTag().setDouble("originY", this.origin.getValue1());
effect.getNbtTag().setDouble("originZ", this.origin.getValue2());
}
iChun.updateUpgradeEffectRenders();
}
}
} else {
return;
}
}
if (!this.worldObj.isRemote) {
if (movObjPos.typeOfHit != MovingObjectType.BLOCK || this.getBlockCollisionBox(this.worldObj, movObjPos.blockX, movObjPos.blockY, movObjPos.blockZ) != null) {
ParticlePacketSender.sendDiggingFx(this.posX, this.posY, this.posZ, this.dimension, Blocks.snow);
this.setDead();
}
this.dataWatcher.updateObject(DW_DEAD, (byte) (this.isDead ? 1 : 0));
}
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityGravelChunk method onImpact.
@Override
protected void onImpact(MovingObjectPosition movObjPos) {
if (movObjPos.entityHit != null) {
float attackDmg = 2.0F + this.rand.nextFloat() * 2.0F;
boolean isEnemy = movObjPos.entityHit instanceof EntityClayMan && this.target instanceof EntityClayMan && ((EntityClayMan) movObjPos.entityHit).getClayTeam().equals(((EntityClayMan) this.target).getClayTeam());
DamageSource dmgSrc = DamageSource.causeThrownDamage(this, this.getThrower());
if (this.getThrower() == null) {
dmgSrc = DamageSource.causeThrownDamage(this, this);
}
if ((movObjPos.entityHit == this.target || isEnemy) && movObjPos.entityHit.attackEntityFrom(dmgSrc, attackDmg)) {
if (this.getThrower() instanceof EntityClayMan) {
((EntityClayMan) this.getThrower()).onProjectileHit(this, movObjPos);
}
} else {
return;
}
}
if (!this.worldObj.isRemote) {
if (movObjPos.typeOfHit != MovingObjectType.BLOCK || this.getBlockCollisionBox(this.worldObj, movObjPos.blockX, movObjPos.blockY, movObjPos.blockZ) != null) {
ParticlePacketSender.sendDiggingFx(this.posX, this.posY, this.posZ, this.dimension, Blocks.gravel);
this.setDead();
}
this.dataWatcher.updateObject(DW_DEAD, (byte) (this.isDead ? 1 : 0));
}
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class UpgradeMagmacream method onSoldierDeath.
@Override
public void onSoldierDeath(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst, DamageSource source) {
if (source instanceof EntityDamageSource && !source.isProjectile() && !source.isExplosion() && source.getEntity() instanceof EntityClayMan) {
EntityClayMan target = (EntityClayMan) source.getEntity();
target.playSound("game.tnt.primed", 1.0F, 1.0F);
target.addEffect(SoldierEffects.getEffect(SoldierEffects.EFF_MAGMABOMB));
target.attackEntityFrom(DamageSource.magic, 0.0F);
}
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class UpgradeRedstone method onProjectileHit.
@Override
public void onProjectileHit(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst, MovingObjectPosition target, ISoldierProjectile<? extends EntityThrowable> projectile) {
if (target.entityHit instanceof EntityClayMan) {
EntityClayMan caddicarus = (EntityClayMan) target.entityHit;
if (caddicarus.addEffect(SoldierEffects.getEffect(SoldierEffects.EFF_REDSTONE)) != null) {
caddicarus.playSound("random.fizz", 1.0F, 1.0F);
upgradeInst.getNbtTag().setShort(NBT_USES, (short) (upgradeInst.getNbtTag().getShort(NBT_USES) - 1));
}
}
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class TileEntityClayNexus method countDamagingEnemies.
private int countDamagingEnemies() {
@SuppressWarnings("unchecked") List<EntityClayMan> soldiers = this.worldObj.getEntitiesWithinAABB(EntityClayMan.class, this.p_damageArea);
int cnt = 0;
for (EntityClayMan dodger : soldiers) {
if (!dodger.getClayTeam().equals(this.p_tempClayTeam.getTeamName())) {
cnt++;
}
}
return cnt;
}
Aggregations