| 1 | package net.minecraft.client.model;
|
| 2 |
|
| 3 | import net.minecraft.entity.Entity;
|
| 4 | import net.minecraft.entity.EntityLivingBase;
|
| 5 | import net.minecraft.entity.boss.EntityWither;
|
| 6 | import net.minecraft.util.MathHelper;
|
| 7 |
|
| 8 | public class ModelWither extends ModelBase
|
| 9 | {
|
| 10 | private ModelRenderer[] field_82905_a;
|
| 11 | private ModelRenderer[] field_82904_b;
|
| 12 |
|
| 13 | public ModelWither(float p_i46302_1_)
|
| 14 | {
|
| 15 | this.textureWidth = 64;
|
| 16 | this.textureHeight = 64;
|
| 17 | this.field_82905_a = new ModelRenderer[3];
|
| 18 | this.field_82905_a[0] = new ModelRenderer(this, 0, 16);
|
| 19 | this.field_82905_a[0].addBox(-10.0F, 3.9F, -0.5F, 20, 3, 3, p_i46302_1_);
|
| 20 | this.field_82905_a[1] = (new ModelRenderer(this)).setTextureSize(this.textureWidth, this.textureHeight);
|
| 21 | this.field_82905_a[1].setRotationPoint(-2.0F, 6.9F, -0.5F);
|
| 22 | this.field_82905_a[1].setTextureOffset(0, 22).addBox(0.0F, 0.0F, 0.0F, 3, 10, 3, p_i46302_1_);
|
| 23 | this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 1.5F, 0.5F, 11, 2, 2, p_i46302_1_);
|
| 24 | this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 4.0F, 0.5F, 11, 2, 2, p_i46302_1_);
|
| 25 | this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 6.5F, 0.5F, 11, 2, 2, p_i46302_1_);
|
| 26 | this.field_82905_a[2] = new ModelRenderer(this, 12, 22);
|
| 27 | this.field_82905_a[2].addBox(0.0F, 0.0F, 0.0F, 3, 6, 3, p_i46302_1_);
|
| 28 | this.field_82904_b = new ModelRenderer[3];
|
| 29 | this.field_82904_b[0] = new ModelRenderer(this, 0, 0);
|
| 30 | this.field_82904_b[0].addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8, p_i46302_1_);
|
| 31 | this.field_82904_b[1] = new ModelRenderer(this, 32, 0);
|
| 32 | this.field_82904_b[1].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6, p_i46302_1_);
|
| 33 | this.field_82904_b[1].rotationPointX = -8.0F;
|
| 34 | this.field_82904_b[1].rotationPointY = 4.0F;
|
| 35 | this.field_82904_b[2] = new ModelRenderer(this, 32, 0);
|
| 36 | this.field_82904_b[2].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6, p_i46302_1_);
|
| 37 | this.field_82904_b[2].rotationPointX = 10.0F;
|
| 38 | this.field_82904_b[2].rotationPointY = 4.0F;
|
| 39 | }
|
| 40 |
|
| 41 | /**
|
| 42 | * Sets the models various rotation angles then renders the model.
|
| 43 | */
|
| 44 | 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)
|
| 45 | {
|
| 46 | this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
|
| 47 |
|
| 48 | for (ModelRenderer modelrenderer : this.field_82904_b)
|
| 49 | {
|
| 50 | modelrenderer.render(scale);
|
| 51 | }
|
| 52 |
|
| 53 | for (ModelRenderer modelrenderer1 : this.field_82905_a)
|
| 54 | {
|
| 55 | modelrenderer1.render(scale);
|
| 56 | }
|
| 57 | }
|
| 58 |
|
| 59 | /**
|
| 60 | * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
|
| 61 | * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
|
| 62 | * "far" arms and legs can swing at most.
|
| 63 | */
|
| 64 | public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
| 65 | {
|
| 66 | float f = MathHelper.cos(ageInTicks * 0.1F);
|
| 67 | this.field_82905_a[1].rotateAngleX = (0.065F + 0.05F * f) * (float)Math.PI;
|
| 68 | this.field_82905_a[2].setRotationPoint(-2.0F, 6.9F + MathHelper.cos(this.field_82905_a[1].rotateAngleX) * 10.0F, -0.5F + MathHelper.sin(this.field_82905_a[1].rotateAngleX) * 10.0F);
|
| 69 | this.field_82905_a[2].rotateAngleX = (0.265F + 0.1F * f) * (float)Math.PI;
|
| 70 | this.field_82904_b[0].rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
|
| 71 | this.field_82904_b[0].rotateAngleX = headPitch / (180F / (float)Math.PI);
|
| 72 | }
|
| 73 |
|
| 74 | /**
|
| 75 | * Used for easily adding entity-dependent animations. The second and third float params here are the same second
|
| 76 | * and third as in the setRotationAngles method.
|
| 77 | */
|
| 78 | public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
|
| 79 | {
|
| 80 | EntityWither entitywither = (EntityWither)entitylivingbaseIn;
|
| 81 |
|
| 82 | for (int i = 1; i < 3; ++i)
|
| 83 | {
|
| 84 | this.field_82904_b[i].rotateAngleY = (entitywither.func_82207_a(i - 1) - entitylivingbaseIn.renderYawOffset) / (180F / (float)Math.PI);
|
| 85 | this.field_82904_b[i].rotateAngleX = entitywither.func_82210_r(i - 1) / (180F / (float)Math.PI);
|
| 86 | }
|
| 87 | }
|
| 88 | }
|
| 89 |
|