    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.util.MathHelper;
    007
    008@SideOnly(Side.CLIENT)
    009public class ModelBlaze extends ModelBase
    010{
    011    /** The sticks that fly around the Blaze. */
    012    private ModelRenderer[] blazeSticks = new ModelRenderer[12];
    013    private ModelRenderer blazeHead;
    014
    015    public ModelBlaze()
    016    {
    017        for (int i = 0; i < this.blazeSticks.length; ++i)
    018        {
    019            this.blazeSticks[i] = new ModelRenderer(this, 0, 16);
    020            this.blazeSticks[i].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2);
    021        }
    022
    023        this.blazeHead = new ModelRenderer(this, 0, 0);
    024        this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);
    025    }
    026
    027    public int func_78104_a()
    028    {
    029        return 8;
    030    }
    031
    032    /**
    033     * Sets the models various rotation angles then renders the model.
    034     */
    035    public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    036    {
    037        this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
    038        this.blazeHead.render(par7);
    039
    040        for (int i = 0; i < this.blazeSticks.length; ++i)
    041        {
    042            this.blazeSticks[i].render(par7);
    043        }
    044    }
    045
    046    /**
    047     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
    048     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
    049     * "far" arms and legs can swing at most.
    050     */
    051    public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    052    {
    053        float f6 = par3 * (float)Math.PI * -0.1F;
    054        int i;
    055
    056        for (i = 0; i < 4; ++i)
    057        {
    058            this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + par3) * 0.25F);
    059            this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 9.0F;
    060            this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 9.0F;
    061            ++f6;
    062        }
    063
    064        f6 = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F;
    065
    066        for (i = 4; i < 8; ++i)
    067        {
    068            this.blazeSticks[i].rotationPointY = 2.0F + MathHelper.cos(((float)(i * 2) + par3) * 0.25F);
    069            this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 7.0F;
    070            this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 7.0F;
    071            ++f6;
    072        }
    073
    074        f6 = 0.47123894F + par3 * (float)Math.PI * -0.05F;
    075
    076        for (i = 8; i < 12; ++i)
    077        {
    078            this.blazeSticks[i].rotationPointY = 11.0F + MathHelper.cos(((float)i * 1.5F + par3) * 0.5F);
    079            this.blazeSticks[i].rotationPointX = MathHelper.cos(f6) * 5.0F;
    080            this.blazeSticks[i].rotationPointZ = MathHelper.sin(f6) * 5.0F;
    081            ++f6;
    082        }
    083
    084        this.blazeHead.rotateAngleY = par4 / (180F / (float)Math.PI);
    085        this.blazeHead.rotateAngleX = par5 / (180F / (float)Math.PI);
    086    }
    087}