    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 ModelEnderman extends ModelBiped
    009{
    010    /** Is the enderman carrying a block? */
    011    public boolean isCarrying = false;
    012
    013    /** Is the enderman attacking an entity? */
    014    public boolean isAttacking = false;
    015
    016    public ModelEnderman()
    017    {
    018        super(0.0F, -14.0F, 64, 32);
    019        float f = -14.0F;
    020        float f1 = 0.0F;
    021        this.bipedHeadwear = new ModelRenderer(this, 0, 16);
    022        this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, f1 - 0.5F);
    023        this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + f, 0.0F);
    024        this.bipedBody = new ModelRenderer(this, 32, 16);
    025        this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, f1);
    026        this.bipedBody.setRotationPoint(0.0F, 0.0F + f, 0.0F);
    027        this.bipedRightArm = new ModelRenderer(this, 56, 0);
    028        this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, f1);
    029        this.bipedRightArm.setRotationPoint(-3.0F, 2.0F + f, 0.0F);
    030        this.bipedLeftArm = new ModelRenderer(this, 56, 0);
    031        this.bipedLeftArm.mirror = true;
    032        this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, f1);
    033        this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + f, 0.0F);
    034        this.bipedRightLeg = new ModelRenderer(this, 56, 0);
    035        this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, f1);
    036        this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + f, 0.0F);
    037        this.bipedLeftLeg = new ModelRenderer(this, 56, 0);
    038        this.bipedLeftLeg.mirror = true;
    039        this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, f1);
    040        this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + f, 0.0F);
    041    }
    042
    043    /**
    044     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
    045     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
    046     * "far" arms and legs can swing at most.
    047     */
    048    public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
    049    {
    050        super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
    051        this.bipedHead.showModel = true;
    052        float f6 = -14.0F;
    053        this.bipedBody.rotateAngleX = 0.0F;
    054        this.bipedBody.rotationPointY = f6;
    055        this.bipedBody.rotationPointZ = -0.0F;
    056        this.bipedRightLeg.rotateAngleX -= 0.0F;
    057        this.bipedLeftLeg.rotateAngleX -= 0.0F;
    058        this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX * 0.5D);
    059        this.bipedLeftArm.rotateAngleX = (float)((double)this.bipedLeftArm.rotateAngleX * 0.5D);
    060        this.bipedRightLeg.rotateAngleX = (float)((double)this.bipedRightLeg.rotateAngleX * 0.5D);
    061        this.bipedLeftLeg.rotateAngleX = (float)((double)this.bipedLeftLeg.rotateAngleX * 0.5D);
    062        float f7 = 0.4F;
    063
    064        if (this.bipedRightArm.rotateAngleX > f7)
    065        {
    066            this.bipedRightArm.rotateAngleX = f7;
    067        }
    068
    069        if (this.bipedLeftArm.rotateAngleX > f7)
    070        {
    071            this.bipedLeftArm.rotateAngleX = f7;
    072        }
    073
    074        if (this.bipedRightArm.rotateAngleX < -f7)
    075        {
    076            this.bipedRightArm.rotateAngleX = -f7;
    077        }
    078
    079        if (this.bipedLeftArm.rotateAngleX < -f7)
    080        {
    081            this.bipedLeftArm.rotateAngleX = -f7;
    082        }
    083
    084        if (this.bipedRightLeg.rotateAngleX > f7)
    085        {
    086            this.bipedRightLeg.rotateAngleX = f7;
    087        }
    088
    089        if (this.bipedLeftLeg.rotateAngleX > f7)
    090        {
    091            this.bipedLeftLeg.rotateAngleX = f7;
    092        }
    093
    094        if (this.bipedRightLeg.rotateAngleX < -f7)
    095        {
    096            this.bipedRightLeg.rotateAngleX = -f7;
    097        }
    098
    099        if (this.bipedLeftLeg.rotateAngleX < -f7)
    100        {
    101            this.bipedLeftLeg.rotateAngleX = -f7;
    102        }
    103
    104        if (this.isCarrying)
    105        {
    106            this.bipedRightArm.rotateAngleX = -0.5F;
    107            this.bipedLeftArm.rotateAngleX = -0.5F;
    108            this.bipedRightArm.rotateAngleZ = 0.05F;
    109            this.bipedLeftArm.rotateAngleZ = -0.05F;
    110        }
    111
    112        this.bipedRightArm.rotationPointZ = 0.0F;
    113        this.bipedLeftArm.rotationPointZ = 0.0F;
    114        this.bipedRightLeg.rotationPointZ = 0.0F;
    115        this.bipedLeftLeg.rotationPointZ = 0.0F;
    116        this.bipedRightLeg.rotationPointY = 9.0F + f6;
    117        this.bipedLeftLeg.rotationPointY = 9.0F + f6;
    118        this.bipedHead.rotationPointZ = -0.0F;
    119        this.bipedHead.rotationPointY = f6 + 1.0F;
    120        this.bipedHeadwear.rotationPointX = this.bipedHead.rotationPointX;
    121        this.bipedHeadwear.rotationPointY = this.bipedHead.rotationPointY;
    122        this.bipedHeadwear.rotationPointZ = this.bipedHead.rotationPointZ;
    123        this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX;
    124        this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY;
    125        this.bipedHeadwear.rotateAngleZ = this.bipedHead.rotateAngleZ;
    126
    127        if (this.isAttacking)
    128        {
    129            float f8 = 1.0F;
    130            this.bipedHead.rotationPointY -= f8 * 5.0F;
    131        }
    132    }
    133}