    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.util.Random;
    006    import org.lwjgl.opengl.GL11;
    007
    008    @SideOnly(Side.CLIENT)
    009    public class ModelGhast extends ModelBase
    010    {
    011        ModelRenderer body;
    012        ModelRenderer[] tentacles = new ModelRenderer[9];
    013
    014        public ModelGhast()
    015        {
    016            byte var1 = -16;
    017            this.body = new ModelRenderer(this, 0, 0);
    018            this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16);
    019            this.body.rotationPointY += (float)(24 + var1);
    020            Random var2 = new Random(1660L);
    021
    022            for (int var3 = 0; var3 < this.tentacles.length; ++var3)
    023            {
    024                this.tentacles[var3] = new ModelRenderer(this, 0, 0);
    025                float var4 = (((float)(var3 % 3) - (float)(var3 / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F;
    026                float var5 = ((float)(var3 / 3) / 2.0F * 2.0F - 1.0F) * 5.0F;
    027                int var6 = var2.nextInt(7) + 8;
    028                this.tentacles[var3].addBox(-1.0F, 0.0F, -1.0F, 2, var6, 2);
    029                this.tentacles[var3].rotationPointX = var4;
    030                this.tentacles[var3].rotationPointZ = var5;
    031                this.tentacles[var3].rotationPointY = (float)(31 + var1);
    032            }
    033        }
    034
    035        /**
    036         * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
    037         * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
    038         * "far" arms and legs can swing at most.
    039         */
    040        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    041        {
    042            for (int var8 = 0; var8 < this.tentacles.length; ++var8)
    043            {
    044                this.tentacles[var8].rotateAngleX = 0.2F * MathHelper.sin(par3 * 0.3F + (float)var8) + 0.4F;
    045            }
    046        }
    047
    048        /**
    049         * Sets the models various rotation angles then renders the model.
    050         */
    051        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    052        {
    053            this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
    054            GL11.glPushMatrix();
    055            GL11.glTranslatef(0.0F, 0.6F, 0.0F);
    056            this.body.render(par7);
    057            ModelRenderer[] var8 = this.tentacles;
    058            int var9 = var8.length;
    059
    060            for (int var10 = 0; var10 < var9; ++var10)
    061            {
    062                ModelRenderer var11 = var8[var10];
    063                var11.render(par7);
    064            }
    065
    066            GL11.glPopMatrix();
    067        }
    068    }