    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    @SideOnly(Side.CLIENT)
    007    public class ModelSpider extends ModelBase
    008    {
    009        /** The spider's head box */
    010        public ModelRenderer spiderHead;
    011
    012        /** The spider's neck box */
    013        public ModelRenderer spiderNeck;
    014
    015        /** The spider's body box */
    016        public ModelRenderer spiderBody;
    017
    018        /** Spider's first leg */
    019        public ModelRenderer spiderLeg1;
    020
    021        /** Spider's second leg */
    022        public ModelRenderer spiderLeg2;
    023
    024        /** Spider's third leg */
    025        public ModelRenderer spiderLeg3;
    026
    027        /** Spider's fourth leg */
    028        public ModelRenderer spiderLeg4;
    029
    030        /** Spider's fifth leg */
    031        public ModelRenderer spiderLeg5;
    032
    033        /** Spider's sixth leg */
    034        public ModelRenderer spiderLeg6;
    035
    036        /** Spider's seventh leg */
    037        public ModelRenderer spiderLeg7;
    038
    039        /** Spider's eight leg */
    040        public ModelRenderer spiderLeg8;
    041
    042        public ModelSpider()
    043        {
    044            float var1 = 0.0F;
    045            byte var2 = 15;
    046            this.spiderHead = new ModelRenderer(this, 32, 4);
    047            this.spiderHead.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, var1);
    048            this.spiderHead.setRotationPoint(0.0F, (float)var2, -3.0F);
    049            this.spiderNeck = new ModelRenderer(this, 0, 0);
    050            this.spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, var1);
    051            this.spiderNeck.setRotationPoint(0.0F, (float)var2, 0.0F);
    052            this.spiderBody = new ModelRenderer(this, 0, 12);
    053            this.spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, var1);
    054            this.spiderBody.setRotationPoint(0.0F, (float)var2, 9.0F);
    055            this.spiderLeg1 = new ModelRenderer(this, 18, 0);
    056            this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    057            this.spiderLeg1.setRotationPoint(-4.0F, (float)var2, 2.0F);
    058            this.spiderLeg2 = new ModelRenderer(this, 18, 0);
    059            this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    060            this.spiderLeg2.setRotationPoint(4.0F, (float)var2, 2.0F);
    061            this.spiderLeg3 = new ModelRenderer(this, 18, 0);
    062            this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    063            this.spiderLeg3.setRotationPoint(-4.0F, (float)var2, 1.0F);
    064            this.spiderLeg4 = new ModelRenderer(this, 18, 0);
    065            this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    066            this.spiderLeg4.setRotationPoint(4.0F, (float)var2, 1.0F);
    067            this.spiderLeg5 = new ModelRenderer(this, 18, 0);
    068            this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    069            this.spiderLeg5.setRotationPoint(-4.0F, (float)var2, 0.0F);
    070            this.spiderLeg6 = new ModelRenderer(this, 18, 0);
    071            this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    072            this.spiderLeg6.setRotationPoint(4.0F, (float)var2, 0.0F);
    073            this.spiderLeg7 = new ModelRenderer(this, 18, 0);
    074            this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    075            this.spiderLeg7.setRotationPoint(-4.0F, (float)var2, -1.0F);
    076            this.spiderLeg8 = new ModelRenderer(this, 18, 0);
    077            this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1);
    078            this.spiderLeg8.setRotationPoint(4.0F, (float)var2, -1.0F);
    079        }
    080
    081        /**
    082         * Sets the models various rotation angles then renders the model.
    083         */
    084        public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
    085        {
    086            this.setRotationAngles(par2, par3, par4, par5, par6, par7);
    087            this.spiderHead.render(par7);
    088            this.spiderNeck.render(par7);
    089            this.spiderBody.render(par7);
    090            this.spiderLeg1.render(par7);
    091            this.spiderLeg2.render(par7);
    092            this.spiderLeg3.render(par7);
    093            this.spiderLeg4.render(par7);
    094            this.spiderLeg5.render(par7);
    095            this.spiderLeg6.render(par7);
    096            this.spiderLeg7.render(par7);
    097            this.spiderLeg8.render(par7);
    098        }
    099
    100        /**
    101         * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
    102         * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
    103         * "far" arms and legs can swing at most.
    104         */
    105        public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6)
    106        {
    107            this.spiderHead.rotateAngleY = par4 / (180F / (float)Math.PI);
    108            this.spiderHead.rotateAngleX = par5 / (180F / (float)Math.PI);
    109            float var7 = ((float)Math.PI / 4F);
    110            this.spiderLeg1.rotateAngleZ = -var7;
    111            this.spiderLeg2.rotateAngleZ = var7;
    112            this.spiderLeg3.rotateAngleZ = -var7 * 0.74F;
    113            this.spiderLeg4.rotateAngleZ = var7 * 0.74F;
    114            this.spiderLeg5.rotateAngleZ = -var7 * 0.74F;
    115            this.spiderLeg6.rotateAngleZ = var7 * 0.74F;
    116            this.spiderLeg7.rotateAngleZ = -var7;
    117            this.spiderLeg8.rotateAngleZ = var7;
    118            float var8 = -0.0F;
    119            float var9 = 0.3926991F;
    120            this.spiderLeg1.rotateAngleY = var9 * 2.0F + var8;
    121            this.spiderLeg2.rotateAngleY = -var9 * 2.0F - var8;
    122            this.spiderLeg3.rotateAngleY = var9 * 1.0F + var8;
    123            this.spiderLeg4.rotateAngleY = -var9 * 1.0F - var8;
    124            this.spiderLeg5.rotateAngleY = -var9 * 1.0F + var8;
    125            this.spiderLeg6.rotateAngleY = var9 * 1.0F - var8;
    126            this.spiderLeg7.rotateAngleY = -var9 * 2.0F + var8;
    127            this.spiderLeg8.rotateAngleY = var9 * 2.0F - var8;
    128            float var10 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + 0.0F) * 0.4F) * par2;
    129            float var11 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * par2;
    130            float var12 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * par2;
    131            float var13 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2;
    132            float var14 = Math.abs(MathHelper.sin(par1 * 0.6662F + 0.0F) * 0.4F) * par2;
    133            float var15 = Math.abs(MathHelper.sin(par1 * 0.6662F + (float)Math.PI) * 0.4F) * par2;
    134            float var16 = Math.abs(MathHelper.sin(par1 * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * par2;
    135            float var17 = Math.abs(MathHelper.sin(par1 * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2;
    136            this.spiderLeg1.rotateAngleY += var10;
    137            this.spiderLeg2.rotateAngleY += -var10;
    138            this.spiderLeg3.rotateAngleY += var11;
    139            this.spiderLeg4.rotateAngleY += -var11;
    140            this.spiderLeg5.rotateAngleY += var12;
    141            this.spiderLeg6.rotateAngleY += -var12;
    142            this.spiderLeg7.rotateAngleY += var13;
    143            this.spiderLeg8.rotateAngleY += -var13;
    144            this.spiderLeg1.rotateAngleZ += var14;
    145            this.spiderLeg2.rotateAngleZ += -var14;
    146            this.spiderLeg3.rotateAngleZ += var15;
    147            this.spiderLeg4.rotateAngleZ += -var15;
    148            this.spiderLeg5.rotateAngleZ += var16;
    149            this.spiderLeg6.rotateAngleZ += -var16;
    150            this.spiderLeg7.rotateAngleZ += var17;
    151            this.spiderLeg8.rotateAngleZ += -var17;
    152        }
    153    }