Search in sources :

Example 1 with EntityClayMan

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

the class ItemClayManDoll method spawnClayMan.

/**
 * Spawns the soldier specified by the team in the location specified by the last three parameters.
 *
 * @param world the World the entity will spawn in
 * @param team  the team the soldier will be
 */
public static EntityClayMan spawnClayMan(World world, String team, double x, double y, double z) {
    EntityClayMan jordan = new EntityClayMan(world, team);
    jordan.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
    jordan.rotationYawHead = jordan.rotationYaw;
    jordan.renderYawOffset = jordan.rotationYaw;
    world.spawnEntityInWorld(jordan);
    jordan.playSound("step.gravel", 1.0F, 1.0F);
    return jordan;
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan)

Example 2 with EntityClayMan

use of de.sanandrew.mods.claysoldiers.entity.EntityClayMan 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 3 with EntityClayMan

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

the class EntityFirechargeChunk method onImpact.

@Override
protected void onImpact(MovingObjectPosition movObjPos) {
    if (!this.worldObj.isRemote) {
        if (movObjPos.entityHit != null) {
            float attackDmg = 1.0F + this.rand.nextFloat();
            boolean isEnemy = movObjPos.entityHit instanceof EntityClayMan && this.target instanceof EntityClayMan && ((EntityClayMan) movObjPos.entityHit).getClayTeam().equals(((EntityClayMan) this.target).getClayTeam());
            DamageSource dmgSrc = DamageSource.causeThrownDamage(this, this.getThrower());
            if (this.getThrower() == null) {
                dmgSrc = DamageSource.causeThrownDamage(this, this);
            }
            if ((movObjPos.entityHit == this.target || isEnemy) && movObjPos.entityHit.attackEntityFrom(dmgSrc, attackDmg)) {
                if (this.getThrower() instanceof EntityClayMan) {
                    ((EntityClayMan) this.getThrower()).onProjectileHit(this, movObjPos);
                }
                if (movObjPos.entityHit instanceof EntityClayMan) {
                    movObjPos.entityHit.setFire(3);
                    movObjPos.entityHit.playSound("random.fizz", 1.0F, 1.0F);
                }
            } else {
                return;
            }
        }
        if (movObjPos.typeOfHit != MovingObjectType.BLOCK || this.getBlockCollisionBox(this.worldObj, movObjPos.blockX, movObjPos.blockY, movObjPos.blockZ) != null) {
            // TODO: substitude! change it when
            ParticlePacketSender.sendDiggingFx(this.posX, this.posY, this.posZ, this.dimension, Blocks.obsidian);
            // TODO: proper texture arrives
            this.setDead();
        }
        this.dataWatcher.updateObject(DW_DEAD, (byte) (this.isDead ? 1 : 0));
    }
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) DamageSource(net.minecraft.util.DamageSource)

Example 4 with EntityClayMan

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

the class EntitySnowChunk method onImpact.

@Override
protected void onImpact(MovingObjectPosition movObjPos) {
    if (movObjPos.entityHit != null) {
        boolean isEnemy = movObjPos.entityHit instanceof EntityClayMan && this.target instanceof EntityClayMan && ((EntityClayMan) movObjPos.entityHit).getClayTeam().equals(((EntityClayMan) this.target).getClayTeam());
        DamageSource dmgSrc = DamageSource.causeThrownDamage(this, this.getThrower());
        if (this.getThrower() == null) {
            dmgSrc = DamageSource.causeThrownDamage(this, this);
        }
        if ((movObjPos.entityHit == this.target || isEnemy) && movObjPos.entityHit.attackEntityFrom(dmgSrc, 0.0F)) {
            if (this.getThrower() instanceof EntityClayMan) {
                ((EntityClayMan) this.getThrower()).onProjectileHit(this, movObjPos);
            }
            if (movObjPos.entityHit instanceof EntityClayMan) {
                if (((EntityClayMan) movObjPos.entityHit).addEffect(SoldierEffects.getEffect(SoldierEffects.EFF_SLOWMOTION)) != null) {
                    movObjPos.entityHit.playSound("step.snow", 1.0F, 1.0F);
                }
            }
        } else {
            return;
        }
    }
    if (!this.worldObj.isRemote) {
        if (movObjPos.typeOfHit != MovingObjectType.BLOCK || this.getBlockCollisionBox(this.worldObj, movObjPos.blockX, movObjPos.blockY, movObjPos.blockZ) != null) {
            ParticlePacketSender.sendDiggingFx(this.posX, this.posY, this.posZ, this.dimension, Blocks.snow);
            this.setDead();
        }
        this.dataWatcher.updateObject(DW_DEAD, (byte) (this.isDead ? 1 : 0));
    }
}
Also used : EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) DamageSource(net.minecraft.util.DamageSource)

Example 5 with EntityClayMan

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

the class ClientProxy method applySoldierRenderFlags.

@Override
public void applySoldierRenderFlags(int entityId, long upgFlags1, long upgFlags2, long effFlags1, long effFlags2) {
    World world = Minecraft.getMinecraft().theWorld;
    Entity entity = world.getEntityByID(entityId);
    if (entity instanceof EntityClayMan) {
        EntityClayMan clayman = (EntityClayMan) entity;
        clayman.applyRenderFlags(upgFlags1, upgFlags2, effFlags1, effFlags2);
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityClayMan(de.sanandrew.mods.claysoldiers.entity.EntityClayMan) World(net.minecraft.world.World)

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