use of sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan 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.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityTurtle method updateEntityActionState.
@Override
public void updateEntityActionState() {
if (riddenByEntity == null || !(riddenByEntity instanceof EntityClayMan)) {
super.updateEntityActionState();
} else {
EntityClayMan rider = (EntityClayMan) riddenByEntity;
isJumping = rider.isJumping() || handleWaterMovement();
moveForward = rider.getMoveForward() * (rider.getSpeedMulti());
moveStrafing = rider.getMoveStrafing() * (rider.getSpeedMulti());
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 sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class ClientProxy method swingSoldierArm.
@Override
public void swingSoldierArm(byte[] data, Player player) {
WorldClient world = (WorldClient) ((EntityPlayer) player).worldObj;
Entity entity = world.getEntityByID(getEntityIdFromByteArray(data));
if (entity != null && entity instanceof EntityClayMan)
((EntityClayMan) entity).swingArm();
}
use of sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan 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.EntityClayMan in project ClaySoldiersMod by SanAndreasP.
the class EntityGecko method updateEntityActionState.
@Override
public void updateEntityActionState() {
if (riddenByEntity == null || !(riddenByEntity instanceof EntityClayMan)) {
super.updateEntityActionState();
} else {
EntityClayMan rider = (EntityClayMan) riddenByEntity;
isJumping = rider.isJumping() || handleWaterMovement();
this.moveSpeed = rider.getSpeedMulti();
// moveForward = rider.getMoveForward() * (rider.getSpeedMulti()) * moveSpeed;
// moveStrafing = rider.getMoveStrafing() * (rider.getSpeedMulti()) * moveSpeed;
rotationYaw = prevRotationYaw = rider.rotationYaw;
rotationPitch = prevRotationPitch = rider.rotationPitch;
rider.renderYawOffset = renderYawOffset;
riddenByEntity.fallDistance = 0.0F;
if (rider.isDead || rider.getHealth() <= 0) {
rider.mountEntity(null);
}
}
}
Aggregations