Search in sources :

Example 11 with EntityClayMan

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;
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 12 with EntityClayMan

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);
        }
    }
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 13 with EntityClayMan

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

Example 14 with EntityClayMan

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);
        }
    }
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 15 with EntityClayMan

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);
        }
    }
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Aggregations

EntityClayMan (de.sanandrew.mods.claysoldiers.entity.EntityClayMan)30 Entity (net.minecraft.entity.Entity)7 ISoldierProjectile (de.sanandrew.mods.claysoldiers.entity.projectile.ISoldierProjectile)4 DamageSource (net.minecraft.util.DamageSource)4 Block (net.minecraft.block.Block)2 World (net.minecraft.world.World)2 RGBAValues (de.sanandrew.core.manpack.util.helpers.SAPUtils.RGBAValues)1 Quartet (de.sanandrew.core.manpack.util.javatuples.Quartet)1 EntityBunnyMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityBunnyMount)1 EntityGeckoMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityGeckoMount)1 EntityHorseMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityHorseMount)1 EntityTurtleMount (de.sanandrew.mods.claysoldiers.entity.mount.EntityTurtleMount)1 ClaymanTeam (de.sanandrew.mods.claysoldiers.util.soldier.ClaymanTeam)1 ASoldierEffect (de.sanandrew.mods.claysoldiers.util.soldier.effect.ASoldierEffect)1 SoldierEffectInst (de.sanandrew.mods.claysoldiers.util.soldier.effect.SoldierEffectInst)1 ASoldierUpgrade (de.sanandrew.mods.claysoldiers.util.soldier.upgrade.ASoldierUpgrade)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityThrowable (net.minecraft.entity.projectile.EntityThrowable)1