    001package net.minecraft.client.model;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.entity.Entity;
    006
    007@SideOnly(Side.CLIENT)
    008public class ModelSquid extends ModelBase
    009{
    010    /** The squid's body */
    011    ModelRenderer squidBody;
    012
    013    /** The squid's tentacles */
    014    ModelRenderer[] squidTentacles = new ModelRenderer[8];
    015
    016    public ModelSquid()
    017    {
    018        byte b0 = -16;
    019        this.squidBody = new ModelRenderer(this, 0, 0);
    020        this.squidBody.addBox(-6.0F, -8.0F, -6.0F, 12, 16, 12);
    021        this.squidBody.rotationPointY += (float)(24 + b0);
    022
    023        for (int i = 0; i < this.squidTentacles.length; ++i)
    024        {
    025            this.squidTentacles[i] = new ModelRenderer(this, 48, 0);
    026            double d0 = (double)i * Math.PI * 2.0D / (double)this.squidTentacles.length;
    027            float f = (float)Math.cos(d0) * 5.0F;
    028            float f1 = (float)Math.sin(d0) * 5.0F;
    029            this.squidTentacles[i].addBox(-1.0F, 0.0F, -1.0F, 2, 18, 2);
    030            this.squidTentacles[i].rotationPointX = f;
    031            this.squidTentacles[i].rotationPointZ = f1;
    032            this.squidTentacles[i].rotationPointY = (float)(31 + b0);
    033            d0 = (double)i * Math.PI * -2.0D / (double)this.squidTentacles.length + (Math.PI / 2D);
    034            this.squidTentacles[i].rotateAngleY = (float)d0;
    035        }
    036    }
    037
    038    /**
    039     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
    040     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
    041     * "far" arms and legs can swing at most.
    042     */
    043    public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    044    {
    045        ModelRenderer[] amodelrenderer = this.squidTentacles;
    046        int i = amodelrenderer.length;
    047
    048        for (int j = 0; j < i; ++j)
    049        {
    050            ModelRenderer modelrenderer = amodelrenderer[j];
    051            modelrenderer.rotateAngleX = par3;
    052        }
    053    }
    054
    055    /**
    056     * Sets the models various rotation angles then renders the model.
    057     */
    058    public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    059    {
    060        this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
    061        this.squidBody.render(par7);
    062
    063        for (int i = 0; i < this.squidTentacles.length; ++i)
    064        {
    065            this.squidTentacles[i].render(par7);
    066        }
    067    }
    068}