use of sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball in project ClaySoldiersMod by SanAndreasP.
the class EntityHorse method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource damagesource, float i) {
float origDmg = i;
boolean hasSpec = rand.nextInt(16) == 0;
if (damagesource.isFireDamage() && this.dataWatcher.getWatchableObjectByte(18) <= 0 && hasSpec)
specDeath = true;
else
specDeath = false;
Entity e = damagesource.getSourceOfDamage();
if ((e == null || !(e instanceof EntityClayMan)) && !damagesource.isFireDamage()) {
i = 100;
}
if (damagesource.isFireDamage() && this.dataWatcher.getWatchableObjectByte(18) > 0) {
i = 0;
}
if (riddenByEntity != null && riddenByEntity instanceof EntityClayMan) {
if (e instanceof EntityGravelChunk) {
if (((EntityGravelChunk) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntityFireball) {
if (((EntityFireball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntitySnowball) {
if (((EntitySnowball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
}
boolean fred = super.attackEntityFrom(damagesource, i);
if (fred && this.getHealth() <= 0) {
// Item item1 = CSM_ModRegistry.horseDoll;
for (int j = 0; j < 4; j++) {
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D);
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
CSMModRegistry.proxy.showEffect(this.worldObj, this, 13);
// if (FMLCommonHandler.instance().getSide().isClient())
// CSM_ModRegistry.proxy.showEffect((new EntityDiggingFX(CSM_ModRegistry.proxy.getClientWorld(), a, b, c, 0.0D, 0.0D, 0.0D, Block.dirt, 0, 0)));
}
if (damagesource.isFireDamage() && this.dataWatcher.getWatchableObjectByte(18) <= 0 && this.getHealth() <= 2 && hasSpec) {
EntityHorse entity = new EntityHorse(worldObj, posX, posY, posZ, this.getType());
entity.setNightmare(true);
entity.setAltTex(rand.nextInt(3) != 0 ? 0 : rand.nextInt(Textures.HORSE_NIGHTMARE.length));
// entity.texture = entity.dirtHorseTexture(entity.dataWatcher.getWatchableObjectShort(19));
entity.setHorseSpecs(entity.getType());
worldObj.spawnEntityInWorld(entity);
}
isDead = true;
}
return fred;
}
use of sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball in project ClaySoldiersMod by SanAndreasP.
the class EntityTurtle method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource damagesource, float i) {
float origDmg = i;
int randSpec = rand.nextInt(16);
if ((damagesource.equals(DamageSource.magic)) && this.dataWatcher.getWatchableObjectByte(18) <= 0 && randSpec == 0)
specDeath = true;
else
specDeath = false;
Entity e = damagesource.getSourceOfDamage();
if (e == null || !(e instanceof EntityClayMan) && !(e instanceof EntityGravelChunk) && !(e instanceof EntityTurtle) && !(damagesource.equals(DamageSource.magic))) {
i = 100;
}
if ((damagesource.equals(DamageSource.magic)) && this.dataWatcher.getWatchableObjectByte(18) > 0) {
i = 0;
}
if (this.dataWatcher.getWatchableObjectShort(19) != 3 && this.dataWatcher.getWatchableObjectShort(19) != 6 && (damagesource.equals(DamageSource.inFire) || damagesource.equals(DamageSource.onFire))) {
return false;
}
if (riddenByEntity != null && riddenByEntity instanceof EntityClayMan) {
if (e instanceof EntityGravelChunk) {
if (((EntityGravelChunk) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntityFireball) {
if (((EntityFireball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntitySnowball) {
if (((EntitySnowball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
}
boolean fred = super.attackEntityFrom(damagesource, i);
if (fred && e != null && !(e instanceof EntityTurtle) && !(e instanceof EntityGravelChunk) && !(e instanceof EntityPlayer) && !(e instanceof EntityFireball) && !(e instanceof EntitySnowball)) {
float i1 = i / 2F;
e.attackEntityFrom(DamageSource.causeMobDamage(this), i1);
}
if (fred && this.getHealth() <= 0) {
// Item item1 = CSM_ModRegistry.turtle;
for (int j = 0; j < 4; j++) {
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D);
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
// if (FMLCommonHandler.instance().getSide().isClient())
// CSM_ModRegistry.proxy.showEffect((new EntityDiggingFX(CSM_ModRegistry.proxy.getClientWorld(), a, b, c, 0.0D, 0.0D, 0.0D, Block.dirt, 0, 0)));
CSMModRegistry.proxy.showEffect(this.worldObj, this, 13);
}
if ((damagesource.equals(DamageSource.magic)) && !this.isKawako() && randSpec == 0) {
EntityTurtle entity = new EntityTurtle(worldObj, posX, posY, posZ, this.getType());
entity.setKawako(true);
// entity.texture = entity.turtleTexture(entity.dataWatcher.getWatchableObjectShort(19));
entity.setTurtleSpecs(entity.getType());
worldObj.spawnEntityInWorld(entity);
this.setDead();
}
isDead = true;
}
return fred;
}
use of sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball in project ClaySoldiersMod by SanAndreasP.
the class EntityGecko method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource damagesource, float i) {
float origDmg = i;
Entity e = damagesource.getSourceOfDamage();
if ((e == null || !(e instanceof EntityClayMan)) && !damagesource.isFireDamage()) {
i = 100;
}
if (riddenByEntity != null && riddenByEntity instanceof EntityClayMan) {
if (e instanceof EntityGravelChunk) {
if (((EntityGravelChunk) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntityFireball) {
if (((EntityFireball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntitySnowball) {
if (((EntitySnowball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
}
if (e != null && (e instanceof EntityClayMan)) {
// EntityClayMan danz = ((EntityClayMan)e);
// if (danz.getDataWatcherShort("stickPoints") <= 0 ||
// danz.getDataWatcherShort("rodPoints") <= 0 ||
// danz.getDataWatcherShort("shearPointsA") <= 0 ||
// danz.getDataWatcherShort("shearPointsB") <= 0) {
// moveSpeed = 2F;
// } else {
// moveSpeed = 1F;
// }
}
boolean fred = super.attackEntityFrom(damagesource, i);
if (fred && this.getHealth() <= 0) {
for (int j = 0; j < 4; j++) {
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D);
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
CSMModRegistry.proxy.showEffect(this.worldObj, this, 3);
}
isDead = true;
}
return fred;
}
use of sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball in project ClaySoldiersMod by SanAndreasP.
the class EntityBunny method attackEntityFrom.
@Override
public boolean attackEntityFrom(DamageSource damagesource, float i) {
float origDmg = i;
Entity e = damagesource.getSourceOfDamage();
if ((e == null || !(e instanceof EntityClayMan)) && !damagesource.isFireDamage()) {
i = 100F;
}
if (riddenByEntity != null && riddenByEntity instanceof EntityClayMan) {
if (e instanceof EntityGravelChunk) {
if (((EntityGravelChunk) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntityFireball) {
if (((EntityFireball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
if (e instanceof EntitySnowball) {
if (((EntitySnowball) e).getClayTeam() == ((EntityClayMan) riddenByEntity).getClayTeam())
return false;
else
i = origDmg;
}
}
if (this.getHealth() - i <= 0 && rand.nextInt(25) == 0 && !(e instanceof EntityPlayer)) {
this.setHealth(20F);
return false;
}
boolean fred = super.attackEntityFrom(damagesource, i);
if (fred && this.getHealth() <= 0) {
Item item1 = CSMModRegistry.bunnyDoll;
for (int j = 0; j < 4; j++) {
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D);
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D);
CSMModRegistry.proxy.showEffect(this.worldObj, this, 3);
}
isDead = true;
}
return fred;
}
Aggregations