| 1 | package net.minecraft.client.model;
|
| 2 |
|
| 3 | import net.minecraft.entity.Entity;
|
| 4 | import net.minecraft.util.MathHelper;
|
| 5 |
|
| 6 | public class ModelCreeper extends ModelBase
|
| 7 | {
|
| 8 | public ModelRenderer head;
|
| 9 | public ModelRenderer creeperArmor;
|
| 10 | public ModelRenderer body;
|
| 11 | public ModelRenderer leg1;
|
| 12 | public ModelRenderer leg2;
|
| 13 | public ModelRenderer leg3;
|
| 14 | public ModelRenderer leg4;
|
| 15 |
|
| 16 | public ModelCreeper()
|
| 17 | {
|
| 18 | this(0.0F);
|
| 19 | }
|
| 20 |
|
| 21 | public ModelCreeper(float p_i46366_1_)
|
| 22 | {
|
| 23 | int i = 6;
|
| 24 | this.head = new ModelRenderer(this, 0, 0);
|
| 25 | this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i46366_1_);
|
| 26 | this.head.setRotationPoint(0.0F, (float)i, 0.0F);
|
| 27 | this.creeperArmor = new ModelRenderer(this, 32, 0);
|
| 28 | this.creeperArmor.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i46366_1_ + 0.5F);
|
| 29 | this.creeperArmor.setRotationPoint(0.0F, (float)i, 0.0F);
|
| 30 | this.body = new ModelRenderer(this, 16, 16);
|
| 31 | this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i46366_1_);
|
| 32 | this.body.setRotationPoint(0.0F, (float)i, 0.0F);
|
| 33 | this.leg1 = new ModelRenderer(this, 0, 16);
|
| 34 | this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_);
|
| 35 | this.leg1.setRotationPoint(-2.0F, (float)(12 + i), 4.0F);
|
| 36 | this.leg2 = new ModelRenderer(this, 0, 16);
|
| 37 | this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_);
|
| 38 | this.leg2.setRotationPoint(2.0F, (float)(12 + i), 4.0F);
|
| 39 | this.leg3 = new ModelRenderer(this, 0, 16);
|
| 40 | this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_);
|
| 41 | this.leg3.setRotationPoint(-2.0F, (float)(12 + i), -4.0F);
|
| 42 | this.leg4 = new ModelRenderer(this, 0, 16);
|
| 43 | this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, p_i46366_1_);
|
| 44 | this.leg4.setRotationPoint(2.0F, (float)(12 + i), -4.0F);
|
| 45 | }
|
| 46 |
|
| 47 | /**
|
| 48 | * Sets the models various rotation angles then renders the model.
|
| 49 | */
|
| 50 | public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
|
| 51 | {
|
| 52 | this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
|
| 53 | this.head.render(scale);
|
| 54 | this.body.render(scale);
|
| 55 | this.leg1.render(scale);
|
| 56 | this.leg2.render(scale);
|
| 57 | this.leg3.render(scale);
|
| 58 | this.leg4.render(scale);
|
| 59 | }
|
| 60 |
|
| 61 | /**
|
| 62 | * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
|
| 63 | * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
|
| 64 | * "far" arms and legs can swing at most.
|
| 65 | */
|
| 66 | public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
| 67 | {
|
| 68 | this.head.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
|
| 69 | this.head.rotateAngleX = headPitch / (180F / (float)Math.PI);
|
| 70 | this.leg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
|
| 71 | this.leg2.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount;
|
| 72 | this.leg3.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount;
|
| 73 | this.leg4.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
|
| 74 | }
|
| 75 | }
|
| 76 |
|