use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class UpgradeNetherQuartz method onSoldierHurt.
@Override
public boolean onSoldierHurt(EntityClayMan clayMan, SoldierUpgradeInst upgradeInst, DamageSource source, MutableFloat damage) {
byte hits = (byte) (upgradeInst.getNbtTag().getByte("hitCounter") + 1);
if (hits >= 10) {
hits = 0;
for (EntityClayMan rick : clayMan.getSoldiersInRange()) {
if (!rick.getClayTeam().equals(clayMan.getClayTeam()) && rick.getDistanceSqToEntity(clayMan) <= 4.0D) {
double dx = rick.posX - clayMan.posX;
double dz = rick.posZ - clayMan.posZ;
double vecLength = Math.sqrt(dx * dx + dz * dz);
rick.motionX = dx / vecLength;
rick.motionY = 0.3D;
rick.motionZ = dz / vecLength;
}
}
ParticlePacketSender.sendShockwaveFx(clayMan.posX, clayMan.posY, clayMan.posZ, clayMan.yOffset, clayMan.dimension);
upgradeInst.getNbtTag().setShort(NBT_USES, (short) (upgradeInst.getNbtTag().getShort(NBT_USES) - 1));
}
upgradeInst.getNbtTag().setByte("hitCounter", hits);
return false;
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityBunnyMount method updateEntityActionState.
@Override
public void updateEntityActionState() {
if (riddenByEntity == null || !(riddenByEntity instanceof EntityClayMan)) {
super.updateEntityActionState();
} else {
EntityClayMan rider = (EntityClayMan) riddenByEntity;
this.isJumping = true;
this.moveForward = rider.moveForward;
moveStrafing = rider.moveStrafing;
rotationYaw = prevRotationYaw = rider.rotationYaw;
rotationPitch = prevRotationPitch = rider.rotationPitch;
rider.renderYawOffset = renderYawOffset;
riddenByEntity.fallDistance = 0.0F;
if (rider.isDead || rider.getHealth() <= 0) {
rider.mountEntity(null);
}
}
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityHorseMount method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource source, float damage) {
if (source == IDisruptable.DISRUPT_DAMAGE) {
return super.attackEntityFrom(source, damage);
}
boolean shouldSpawnSpecial = rand.nextInt(16) == 0;
this.specialDeath = source.isFireDamage() && !this.isSpecial() && shouldSpawnSpecial;
Entity entity = source.getSourceOfDamage();
if (!(entity instanceof EntityClayMan) && !source.isFireDamage()) {
damage = 999;
} else if (source.isFireDamage() && this.isSpecial()) {
return false;
}
if (this.riddenByEntity instanceof EntityClayMan && source.getEntity() instanceof ISoldierProjectile) {
EntityClayMan clayMan = (EntityClayMan) this.riddenByEntity;
ISoldierProjectile projectile = (ISoldierProjectile) source.getEntity();
if (clayMan.getClayTeam().equals(projectile.getTrowingTeam())) {
return false;
}
}
boolean damageSuccess = super.attackEntityFrom(source, damage);
if (damageSuccess && this.getHealth() <= 0) {
if (source.isFireDamage() && !this.isSpecial() && shouldSpawnSpecial) {
EntityHorseMount specialHorse = new EntityHorseMount(this.worldObj, EnumHorseType.VALUES[this.getType()]);
specialHorse.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
specialHorse.setSpecial();
specialHorse.chooseTexture();
specialHorse.setHorseSpecs();
this.worldObj.spawnEntityInWorld(specialHorse);
}
}
return damageSuccess;
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityHorseMount method updateEntityActionState.
@Override
public void updateEntityActionState() {
if (this.riddenByEntity == null || !(this.riddenByEntity instanceof EntityClayMan)) {
super.updateEntityActionState();
} else {
EntityClayMan rider = (EntityClayMan) this.riddenByEntity;
this.isJumping = rider.isJumping() || this.handleWaterMovement();
this.moveForward = rider.moveForward;
this.moveStrafing = rider.moveStrafing;
this.rotationYaw = this.prevRotationYaw = rider.rotationYaw;
this.rotationPitch = this.prevRotationPitch = rider.rotationPitch;
rider.renderYawOffset = this.renderYawOffset;
rider.fallDistance = 0.0F;
if (rider.isDead || rider.getHealth() <= 0) {
rider.mountEntity(null);
}
}
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityTurtleMount method updateEntityActionState.
@Override
public void updateEntityActionState() {
if (this.riddenByEntity == null || !(this.riddenByEntity instanceof EntityClayMan)) {
super.updateEntityActionState();
} else {
EntityClayMan rider = (EntityClayMan) this.riddenByEntity;
this.isJumping = rider.isJumping() || this.handleWaterMovement();
this.moveForward = rider.moveForward;
this.moveStrafing = rider.moveStrafing;
this.rotationYaw = this.prevRotationYaw = rider.rotationYaw;
this.rotationPitch = this.prevRotationPitch = rider.rotationPitch;
rider.renderYawOffset = this.renderYawOffset;
rider.fallDistance = 0.0F;
if (rider.isDead || rider.getHealth() <= 0) {
rider.mountEntity(null);
}
}
}
Aggregations