use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class ItemClayManDoll method spawnClayMan.
/**
* Spawns the soldier specified by the team in the location specified by the last three parameters.
*
* @param world the World the entity will spawn in
* @param team the team the soldier will be
*/
public static EntityClayMan spawnClayMan(World world, String team, double x, double y, double z) {
EntityClayMan jordan = new EntityClayMan(world, team);
jordan.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
jordan.rotationYawHead = jordan.rotationYaw;
jordan.renderYawOffset = jordan.rotationYaw;
world.spawnEntityInWorld(jordan);
jordan.playSound("step.gravel", 1.0F, 1.0F);
return jordan;
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityGeckoMount method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource source, float damage) {
if (source == IDisruptable.DISRUPT_DAMAGE) {
return super.attackEntityFrom(source, damage);
}
Entity entity = source.getSourceOfDamage();
if (!(entity instanceof EntityClayMan) && !source.isFireDamage()) {
damage = 999;
}
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;
}
}
return super.attackEntityFrom(source, damage);
}
use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityFirechargeChunk method onImpact.
@Override
protected void onImpact(MovingObjectPosition movObjPos) {
if (!this.worldObj.isRemote) {
if (movObjPos.entityHit != null) {
float attackDmg = 1.0F + this.rand.nextFloat();
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);
}
if (movObjPos.entityHit instanceof EntityClayMan) {
movObjPos.entityHit.setFire(3);
movObjPos.entityHit.playSound("random.fizz", 1.0F, 1.0F);
}
} else {
return;
}
}
if (movObjPos.typeOfHit != MovingObjectType.BLOCK || this.getBlockCollisionBox(this.worldObj, movObjPos.blockX, movObjPos.blockY, movObjPos.blockZ) != null) {
// TODO: substitude! change it when
ParticlePacketSender.sendDiggingFx(this.posX, this.posY, this.posZ, this.dimension, Blocks.obsidian);
// TODO: proper texture arrives
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 EntitySnowChunk 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);
}
if ((movObjPos.entityHit == this.target || isEnemy) && movObjPos.entityHit.attackEntityFrom(dmgSrc, 0.0F)) {
if (this.getThrower() instanceof EntityClayMan) {
((EntityClayMan) this.getThrower()).onProjectileHit(this, movObjPos);
}
if (movObjPos.entityHit instanceof EntityClayMan) {
if (((EntityClayMan) movObjPos.entityHit).addEffect(SoldierEffects.getEffect(SoldierEffects.EFF_SLOWMOTION)) != null) {
movObjPos.entityHit.playSound("step.snow", 1.0F, 1.0F);
}
}
} 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 ClientProxy method applySoldierRenderFlags.
@Override
public void applySoldierRenderFlags(int entityId, long upgFlags1, long upgFlags2, long effFlags1, long effFlags2) {
World world = Minecraft.getMinecraft().theWorld;
Entity entity = world.getEntityByID(entityId);
if (entity instanceof EntityClayMan) {
EntityClayMan clayman = (EntityClayMan) entity;
clayman.applyRenderFlags(upgFlags1, upgFlags2, effFlags1, effFlags2);
}
}
Aggregations