    001package net.minecraft.client.model;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.entity.Entity;
    006import net.minecraft.entity.EntityLiving;
    007import net.minecraft.entity.monster.EntityMagmaCube;
    008
    009@SideOnly(Side.CLIENT)
    010public class ModelMagmaCube extends ModelBase
    011{
    012    ModelRenderer[] field_78109_a = new ModelRenderer[8];
    013    ModelRenderer field_78108_b;
    014
    015    public ModelMagmaCube()
    016    {
    017        for (int i = 0; i < this.field_78109_a.length; ++i)
    018        {
    019            byte b0 = 0;
    020            int j = i;
    021
    022            if (i == 2)
    023            {
    024                b0 = 24;
    025                j = 10;
    026            }
    027            else if (i == 3)
    028            {
    029                b0 = 24;
    030                j = 19;
    031            }
    032
    033            this.field_78109_a[i] = new ModelRenderer(this, b0, j);
    034            this.field_78109_a[i].addBox(-4.0F, (float)(16 + i), -4.0F, 8, 1, 8);
    035        }
    036
    037        this.field_78108_b = new ModelRenderer(this, 0, 16);
    038        this.field_78108_b.addBox(-2.0F, 18.0F, -2.0F, 4, 4, 4);
    039    }
    040
    041    public int func_78107_a()
    042    {
    043        return 5;
    044    }
    045
    046    /**
    047     * Used for easily adding entity-dependent animations. The second and third float params here are the same second
    048     * and third as in the setRotationAngles method.
    049     */
    050    public void setLivingAnimations(EntityLiving par1EntityLiving, float par2, float par3, float par4)
    051    {
    052        EntityMagmaCube entitymagmacube = (EntityMagmaCube)par1EntityLiving;
    053        float f3 = entitymagmacube.field_70812_c + (entitymagmacube.field_70811_b - entitymagmacube.field_70812_c) * par4;
    054
    055        if (f3 < 0.0F)
    056        {
    057            f3 = 0.0F;
    058        }
    059
    060        for (int i = 0; i < this.field_78109_a.length; ++i)
    061        {
    062            this.field_78109_a[i].rotationPointY = (float)(-(4 - i)) * f3 * 1.7F;
    063        }
    064    }
    065
    066    /**
    067     * Sets the models various rotation angles then renders the model.
    068     */
    069    public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    070    {
    071        this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
    072        this.field_78108_b.render(par7);
    073
    074        for (int i = 0; i < this.field_78109_a.length; ++i)
    075        {
    076            this.field_78109_a[i].render(par7);
    077        }
    078    }
    079}