Search in sources :

Example 6 with EntityClayMan

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;
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityFireball(sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball) EntityGravelChunk(sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityGravelChunk)

Example 7 with EntityClayMan

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);
        }
    }
}
Also used : EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan)

Example 8 with EntityClayMan

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();
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) WorldClient(net.minecraft.client.multiplayer.WorldClient)

Example 9 with EntityClayMan

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;
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) EntityFireball(sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball) EntityGravelChunk(sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityGravelChunk)

Example 10 with EntityClayMan

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);
        }
    }
}
Also used : EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan)

Aggregations

EntityClayMan (sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan)24 Entity (net.minecraft.entity.Entity)12 List (java.util.List)7 EntityLiving (net.minecraft.entity.EntityLiving)5 EntityFireball (sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityFireball)4 EntityGravelChunk (sanandreasp.mods.ClaySoldiersMod.entity.projectile.EntityGravelChunk)4 EntityMob (net.minecraft.entity.monster.EntityMob)3 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)3 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)3 Vec3 (net.minecraft.util.Vec3)3 ModelClayMan (sanandreasp.mods.ClaySoldiersMod.client.model.ModelClayMan)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 WorldClient (net.minecraft.client.multiplayer.WorldClient)1 EntityItem (net.minecraft.entity.item.EntityItem)1 Item (net.minecraft.item.Item)1 PotionEffect (net.minecraft.potion.PotionEffect)1 EntityBunny (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityBunny)1 EntityGecko (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko)1 EntityHorse (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityHorse)1 EntityPegasus (sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityPegasus)1