Search in sources :

Example 21 with EntityClayMan

use of sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.

the class RenderClayMan method preRenderCallback.

@Override
protected void preRenderCallback(EntityLivingBase entityliving, float f) {
    EntityClayMan c1 = (EntityClayMan) entityliving;
    mc1.hasArmor = c1.hasUpgrade(CSMModRegistry.clayUpgRegistry.getIDByUpgradeClass(UpgLeather.class));
    // mc1.hasStick = c1.hasStick();
    // mc1.hasBlazeRod = c1.hasBlazeRod();
    // mc1.hasSpecks = c1.hasGunPowder();
    // mc1.hasCrown = c1.hasCrown();
    // if (mc1.isPadded = c1.isPadded())
    // mc1.colorPadded = EntityClayMan.padColorTable[c1.getPadColor()];
    // 
    // if (mc1.isCaped = c1.isCaped()) {
    // mc1.capeSwing = c1.capeSwing();
    // mc1.capePadded = EntityClayMan.padColorTable[c1.getCapeColor()];
    // }
    // mc1.sittingPos = c1.sittingPos;
    // mc1.isSharpened = c1.isStickSharp();
    // mc1.isGooey = c1.isGooey();
    // mc1.hasLogs = c1.hasLogs();
    // mc1.holdFeather = c1.holdFeather();
    // mc1.hasRocks = c1.hasRocks();
    // mc1.hasGoggles = c1.hasGoggles();
    // mc1.armLeft = c1.armLeft();
    // mc1.isSuper = c1.isSuper();
    // mc1.hasPants = c1.hasPants();
    // if (mc1.isSuper) {
    // mc1.capeSwing = c1.capeSwing();
    // }
    boolean flag = false;
    if (c1.isOnLadder()) {
        // c1.climbTime ++;
        flag = true;
    }
    mc1.isClimbing = flag;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
// if (c1.isCorrupt() && !c1.isGlowing()) {
// int i, j, k;
// i = MathHelper.floor_double(c1.posX);
// j = MathHelper.floor_double(c1.posY);
// k = MathHelper.floor_double(c1.posZ);
// float lightness = c1.worldObj.getFullBlockLightValue(i, j, k);
// if (c1.hurtTime > 0 || c1.deathTime > 0) {
// GL11.glColor3f((lightness / 20F) + 0.5F, 0.2F, 0.2F);
// } else {
// GL11.glColor3f(lightness / 35F, lightness / 35F, lightness / 35F);
// }
// }
// if (c1.holdFeather()) {
// ItemStack itemstack = new ItemStack(Item.feather.itemID, 1, 0);
// GL11.glPushMatrix();
// 
// float f5 = 0.625F;
// 
// GL11.glTranslatef(0F, -1.0F, 0F);
// GL11.glScalef(f5, f5, f5);
// 
// GL11.glTranslatef(0.625F, 0.1F, -0.4F);
// GL11.glRotatef(90F, 0F, 0F, 1F);
// GL11.glRotatef(45F, 0F, 1F, 0F);
// 
// renderManager.itemRenderer.renderItem(entityliving, itemstack, 0);
// GL11.glPopMatrix();
// }
}
Also used : EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan)

Example 22 with EntityClayMan

use of sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.

the class RenderClayMan method doRenderLiving.

@Override
public void doRenderLiving(EntityLiving entityliving, double d, double d1, double d2, float f, float f1) {
    f1 *= 2F;
    EntityClayMan entitycm = (EntityClayMan) entityliving;
    GL11.glPushMatrix();
    for (int id : entitycm.getUpgrades()) CSMModRegistry.clayUpgRegistry.getUpgradeByID(id).onPreRender(entitycm, this.renderManager, f, this.mc1);
    super.doRenderLiving(entityliving, d, d1, d2, f, f1);
    for (int id : entitycm.getUpgrades()) CSMModRegistry.clayUpgRegistry.getUpgradeByID(id).onPostRender(entitycm, this.renderManager, f, this.mc1);
    GL11.glPopMatrix();
}
Also used : EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan)

Example 23 with EntityClayMan

use of sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.

the class Handler_BehaviorDispenseItem method getLivingFromItem.

private static EntityLiving getLivingFromItem(World world, double x, double y, double z, ItemStack item) {
    if (item.getItem() instanceof ItemClayMan) {
        EntityClayMan entityclayman = new EntityClayMan(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.gravel", 1.0F, 1.0F / 0.4F + 0.8F);
        return entityclayman;
    } else if (item.getItem() instanceof ItemHorses) {
        EntityHorse entityhorse = new EntityHorse(world, x, y, z, item.getItemDamage());
        if (item.getItem() == CSMModRegistry.pegasusDoll) {
            entityhorse = new EntityPegasus(world, x, y, z, item.getItemDamage());
        }
        world.playSoundEffect(x, y, z, "step.gravel", 1.0F, 1.0F / 0.4F + 1.2F);
        return entityhorse;
    } else if (item.getItem() instanceof ItemTurtle) {
        EntityTurtle entityturtle = new EntityTurtle(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.stone", 1.0F, 1.0F / 0.4F + 0.8F);
        return entityturtle;
    } else if (item.getItem() instanceof ItemBunny) {
        EntityBunny entitybunny = new EntityBunny(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.stone", 1.0F, 1.0F / 0.4F + 0.8F);
        return entitybunny;
    } else if (item.getItem() instanceof ItemGecko) {
        EntityGecko entitygecko = new EntityGecko(world, x, y, z, item.getItemDamage());
        world.playSoundEffect(x, y, z, "step.gravel", 1.0F, 1.0F / 0.4F + 1.2F);
        return entitygecko;
    }
    return null;
}
Also used : ItemTurtle(sanandreasp.mods.ClaySoldiersMod.item.ItemTurtle) EntityHorse(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityHorse) EntityGecko(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityGecko) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) EntityPegasus(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityPegasus) EntityBunny(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityBunny) ItemHorses(sanandreasp.mods.ClaySoldiersMod.item.ItemHorses) EntityTurtle(sanandreasp.mods.ClaySoldiersMod.entity.mount.EntityTurtle) ItemBunny(sanandreasp.mods.ClaySoldiersMod.item.ItemBunny) ItemClayMan(sanandreasp.mods.ClaySoldiersMod.item.ItemClayMan) ItemGecko(sanandreasp.mods.ClaySoldiersMod.item.ItemGecko)

Example 24 with EntityClayMan

use of sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan in project ClaySoldiersMod by SanAndreasP.

the class EntityFireball method onUpdate.

@Override
public void onUpdate() {
    super.onUpdate();
    if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
        float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
        prevRotationYaw = rotationYaw = (float) ((Math.atan2(motionX, motionZ) * 180D) / 3.1415927410125732D);
        prevRotationPitch = rotationPitch = (float) ((Math.atan2(motionY, f) * 180D) / 3.1415927410125732D);
    }
    int i = worldObj.getBlockId(xTile, yTile, zTile);
    if (i > 0) {
        Block.blocksList[i].setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
        AxisAlignedBB axisalignedbb = Block.blocksList[i].getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
        if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) {
            inGround = true;
        }
    }
    if (arrowShake > 0) {
        arrowShake--;
    }
    if (inGround) {
        int j = worldObj.getBlockId(xTile, yTile, zTile);
        int k = worldObj.getBlockMetadata(xTile, yTile, zTile);
        if (j != inTile || k != field_28019_h) {
            inGround = false;
            motionX *= rand.nextFloat() * 0.2F;
            motionY *= rand.nextFloat() * 0.2F;
            motionZ *= rand.nextFloat() * 0.2F;
            ticksInGround = 0;
            ticksInAir = 0;
            return;
        }
        ticksInGround++;
        if (ticksInGround == 1200) {
            setDead();
        }
        return;
    }
    ticksInAir++;
    Vec3 vec3d = Vec3.createVectorHelper(posX, posY, posZ);
    Vec3 vec3d1 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
    MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks_do_do(vec3d, vec3d1, false, true);
    vec3d = Vec3.createVectorHelper(posX, posY, posZ);
    vec3d1 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
    if (movingobjectposition != null) {
        vec3d1 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
    }
    Entity entity = null;
    List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
    double d = 0.0D;
    for (int l = 0; l < list.size(); l++) {
        Entity entity1 = (Entity) list.get(l);
        if (!entity1.canBeCollidedWith() || entity1 == owner && ticksInAir < 5) {
            continue;
        }
        float f4 = 0.3F;
        AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f4, f4, f4);
        MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3d, vec3d1);
        if (movingobjectposition1 == null) {
            continue;
        }
        double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);
        if (d1 < d || d == 0.0D) {
            entity = entity1;
            d = d1;
        }
    }
    if (entity != null) {
        movingobjectposition = new MovingObjectPosition(entity);
    }
    if (movingobjectposition != null) {
        if (movingobjectposition.entityHit != null) {
            int attackU = 0;
            if (!(movingobjectposition.entityHit instanceof EntityClayMan || movingobjectposition.entityHit instanceof EntityMob)) {
                attackU = 2;
            } else {
                if (movingobjectposition.entityHit instanceof EntityClayMan) {
                    if (((EntityClayMan) movingobjectposition.entityHit).getClayTeam() == getClayTeam()) {
                        setDead();
                        return;
                    }
                }
            }
            if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, owner), attackU)) {
                int fire = 4;
                if (owner != null && owner instanceof EntityClayMan) {
                // if (((EntityClayMan)owner).hasCoal)
                // fire = 8;
                }
                movingobjectposition.entityHit.setFire(fire);
                worldObj.playAuxSFXAtEntity(null, 1009, (int) movingobjectposition.entityHit.posX, (int) movingobjectposition.entityHit.posY, (int) movingobjectposition.entityHit.posZ, 0);
                setDead();
            }
        } else {
            xTile = movingobjectposition.blockX;
            yTile = movingobjectposition.blockY;
            zTile = movingobjectposition.blockZ;
            inTile = worldObj.getBlockId(xTile, yTile, zTile);
            field_28019_h = worldObj.getBlockMetadata(xTile, yTile, zTile);
            motionX = (float) (movingobjectposition.hitVec.xCoord - posX);
            motionY = (float) (movingobjectposition.hitVec.yCoord - posY);
            motionZ = (float) (movingobjectposition.hitVec.zCoord - posZ);
            float f1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
            posX -= (motionX / f1) * 0.05000000074505806D;
            posY -= (motionY / f1) * 0.05000000074505806D;
            posZ -= (motionZ / f1) * 0.05000000074505806D;
            inGround = true;
            arrowShake = 7;
        }
    }
    posX += motionX;
    posY += motionY;
    posZ += motionZ;
    float f2 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    rotationYaw = (float) ((Math.atan2(motionX, motionZ) * 180D) / 3.1415927410125732D);
    for (rotationPitch = (float) ((Math.atan2(motionY, f2) * 180D) / 3.1415927410125732D); rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) {
    }
    for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) {
    }
    for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) {
    }
    for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) {
    }
    rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
    rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
    float f3 = 0.99F;
    float f5 = 0.03F;
    if (isInWater()) {
        for (int i1 = 0; i1 < 4; i1++) {
            float f6 = 0.25F;
            worldObj.spawnParticle("bubble", posX - motionX * f6, posY - motionY * f6, posZ - motionZ * f6, motionX, motionY, motionZ);
        }
        f3 = 0.8F;
    }
    motionX *= f3;
    motionY *= f3;
    motionZ *= f3;
    motionY -= f5;
    setPosition(posX, posY, posZ);
    if (ticksInGround > 0 || inGround) {
        isDead = true;
    }
    if (isDead) {
        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, 12);
        // 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.gravel, 0, 0)));
        worldObj.playSoundAtEntity(this, "step.gravel", 0.6F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F));
    }
}
Also used : AxisAlignedBB(net.minecraft.util.AxisAlignedBB) EntityMob(net.minecraft.entity.monster.EntityMob) Entity(net.minecraft.entity.Entity) MovingObjectPosition(net.minecraft.util.MovingObjectPosition) EntityClayMan(sanandreasp.mods.ClaySoldiersMod.entity.EntityClayMan) Vec3(net.minecraft.util.Vec3) List(java.util.List)

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