| 1 | package net.minecraft.client.model;
|
| 2 |
|
| 3 | import net.minecraft.entity.Entity;
|
| 4 | import net.minecraft.util.MathHelper;
|
| 5 |
|
| 6 | public class ModelSnowMan extends ModelBase
|
| 7 | {
|
| 8 | public ModelRenderer body;
|
| 9 | public ModelRenderer bottomBody;
|
| 10 | public ModelRenderer head;
|
| 11 | public ModelRenderer rightHand;
|
| 12 | public ModelRenderer leftHand;
|
| 13 |
|
| 14 | public ModelSnowMan()
|
| 15 | {
|
| 16 | float f = 4.0F;
|
| 17 | float f1 = 0.0F;
|
| 18 | this.head = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64);
|
| 19 | this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, f1 - 0.5F);
|
| 20 | this.head.setRotationPoint(0.0F, 0.0F + f, 0.0F);
|
| 21 | this.rightHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64);
|
| 22 | this.rightHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, f1 - 0.5F);
|
| 23 | this.rightHand.setRotationPoint(0.0F, 0.0F + f + 9.0F - 7.0F, 0.0F);
|
| 24 | this.leftHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64);
|
| 25 | this.leftHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, f1 - 0.5F);
|
| 26 | this.leftHand.setRotationPoint(0.0F, 0.0F + f + 9.0F - 7.0F, 0.0F);
|
| 27 | this.body = (new ModelRenderer(this, 0, 16)).setTextureSize(64, 64);
|
| 28 | this.body.addBox(-5.0F, -10.0F, -5.0F, 10, 10, 10, f1 - 0.5F);
|
| 29 | this.body.setRotationPoint(0.0F, 0.0F + f + 9.0F, 0.0F);
|
| 30 | this.bottomBody = (new ModelRenderer(this, 0, 36)).setTextureSize(64, 64);
|
| 31 | this.bottomBody.addBox(-6.0F, -12.0F, -6.0F, 12, 12, 12, f1 - 0.5F);
|
| 32 | this.bottomBody.setRotationPoint(0.0F, 0.0F + f + 20.0F, 0.0F);
|
| 33 | }
|
| 34 |
|
| 35 | /**
|
| 36 | * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
|
| 37 | * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
|
| 38 | * "far" arms and legs can swing at most.
|
| 39 | */
|
| 40 | public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
| 41 | {
|
| 42 | super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
|
| 43 | this.head.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
|
| 44 | this.head.rotateAngleX = headPitch / (180F / (float)Math.PI);
|
| 45 | this.body.rotateAngleY = netHeadYaw / (180F / (float)Math.PI) * 0.25F;
|
| 46 | float f = MathHelper.sin(this.body.rotateAngleY);
|
| 47 | float f1 = MathHelper.cos(this.body.rotateAngleY);
|
| 48 | this.rightHand.rotateAngleZ = 1.0F;
|
| 49 | this.leftHand.rotateAngleZ = -1.0F;
|
| 50 | this.rightHand.rotateAngleY = 0.0F + this.body.rotateAngleY;
|
| 51 | this.leftHand.rotateAngleY = (float)Math.PI + this.body.rotateAngleY;
|
| 52 | this.rightHand.rotationPointX = f1 * 5.0F;
|
| 53 | this.rightHand.rotationPointZ = -f * 5.0F;
|
| 54 | this.leftHand.rotationPointX = -f1 * 5.0F;
|
| 55 | this.leftHand.rotationPointZ = f * 5.0F;
|
| 56 | }
|
| 57 |
|
| 58 | /**
|
| 59 | * Sets the models various rotation angles then renders the model.
|
| 60 | */
|
| 61 | 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)
|
| 62 | {
|
| 63 | this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
|
| 64 | this.body.render(scale);
|
| 65 | this.bottomBody.render(scale);
|
| 66 | this.head.render(scale);
|
| 67 | this.rightHand.render(scale);
|
| 68 | this.leftHand.render(scale);
|
| 69 | }
|
| 70 | }
|
| 71 |
|