    001    package net.minecraft.client.model;
    002
    003    import cpw.mods.fml.relauncher.Side;
    004    import cpw.mods.fml.relauncher.SideOnly;
    005    import net.minecraft.entity.Entity;
    006    import net.minecraft.entity.EntityLiving;
    007    import net.minecraft.entity.monster.EntityMagmaCube;
    008
    009    @SideOnly(Side.CLIENT)
    010    public 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 var1 = 0; var1 < this.field_78109_a.length; ++var1)
    018            {
    019                byte var2 = 0;
    020                int var3 = var1;
    021
    022                if (var1 == 2)
    023                {
    024                    var2 = 24;
    025                    var3 = 10;
    026                }
    027                else if (var1 == 3)
    028                {
    029                    var2 = 24;
    030                    var3 = 19;
    031                }
    032
    033                this.field_78109_a[var1] = new ModelRenderer(this, var2, var3);
    034                this.field_78109_a[var1].addBox(-4.0F, (float)(16 + var1), -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 var5 = (EntityMagmaCube)par1EntityLiving;
    053            float var6 = var5.field_70812_c + (var5.field_70811_b - var5.field_70812_c) * par4;
    054
    055            if (var6 < 0.0F)
    056            {
    057                var6 = 0.0F;
    058            }
    059
    060            for (int var7 = 0; var7 < this.field_78109_a.length; ++var7)
    061            {
    062                this.field_78109_a[var7].rotationPointY = (float)(-(4 - var7)) * var6 * 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 var8 = 0; var8 < this.field_78109_a.length; ++var8)
    075            {
    076                this.field_78109_a[var8].render(par7);
    077            }
    078        }
    079    }