Search in sources :

Example 1 with ISoldierProjectile

use of de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile 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);
}
Also used : Entity(net.minecraft.entity.Entity) ISoldierProjectile(de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 2 with ISoldierProjectile

use of de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile in project ClaySoldiersMod by SanAndreasP.

the class EntityBunnyMount 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);
}
Also used : Entity(net.minecraft.entity.Entity) ISoldierProjectile(de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 3 with ISoldierProjectile

use of de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile in project ClaySoldiersMod by SanAndreasP.

the class EntityTurtleMount 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.getType() == EnumTurtleType.NETHERRACK.ordinal()) {
        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) {
            EntityTurtleMount kawako = new EntityTurtleMount(this.worldObj, EnumTurtleType.VALUES[this.getType()]);
            kawako.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
            kawako.setSpecial();
            kawako.chooseTexture();
            kawako.setTurtleSpecs();
            this.worldObj.spawnEntityInWorld(kawako);
        }
    }
    return damageSuccess;
}
Also used : Entity(net.minecraft.entity.Entity) ISoldierProjectile(de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 4 with ISoldierProjectile

use of de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile 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;
}
Also used : Entity(net.minecraft.entity.Entity) ISoldierProjectile(de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Aggregations

EntityClayMan (de.sanandrew.mods.claysoldiers.entity.EntityClayMan)4 ISoldierProjectile (de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile)4 Entity (net.minecraft.entity.Entity)4