| 1 | package net.minecraft.client.model;
|
| 2 |
|
| 3 | import net.minecraft.entity.Entity;
|
| 4 | import net.minecraft.util.MathHelper;
|
| 5 |
|
| 6 | public class ModelBlaze extends ModelBase
|
| 7 | {
|
| 8 | /** The sticks that fly around the Blaze. */
|
| 9 | private ModelRenderer[] blazeSticks = new ModelRenderer[12];
|
| 10 | private ModelRenderer blazeHead;
|
| 11 |
|
| 12 | public ModelBlaze()
|
| 13 | {
|
| 14 | for (int i = 0; i < this.blazeSticks.length; ++i)
|
| 15 | {
|
| 16 | this.blazeSticks[i] = new ModelRenderer(this, 0, 16);
|
| 17 | this.blazeSticks[i].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2);
|
| 18 | }
|
| 19 |
|
| 20 | this.blazeHead = new ModelRenderer(this, 0, 0);
|
| 21 | this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);
|
| 22 | }
|
| 23 |
|
| 24 | /**
|
| 25 | * Sets the models various rotation angles then renders the model.
|
| 26 | */
|
| 27 | 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)
|
| 28 | {
|
| 29 | this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
|
| 30 | this.blazeHead.render(scale);
|
| 31 |
|
| 32 | for (int i = 0; i < this.blazeSticks.length; ++i)
|
| 33 | {
|
| 34 | this.blazeSticks[i].render(scale);
|
| 35 | }
|
| 36 | }
|
| 37 |
|
| 38 | /**
|
| 39 | * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
|
| 40 | * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
|
| 41 | * "far" arms and legs can swing at most.
|
| 42 | */
|
| 43 | public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
| 44 | {
|
| 45 | float f = ageInTicks * (float)Math.PI * -0.1F;
|
| 46 |
|
| 47 | for (int i = 0; i < 4; ++i)
|
| 48 | {
|
| 49 | this.blazeSticks[i].rotationPointY = -2.0F + MathHelper.cos(((float)(i * 2) + ageInTicks) * 0.25F);
|
| 50 | this.blazeSticks[i].rotationPointX = MathHelper.cos(f) * 9.0F;
|
| 51 | this.blazeSticks[i].rotationPointZ = MathHelper.sin(f) * 9.0F;
|
| 52 | ++f;
|
| 53 | }
|
| 54 |
|
| 55 | f = ((float)Math.PI / 4F) + ageInTicks * (float)Math.PI * 0.03F;
|
| 56 |
|
| 57 | for (int j = 4; j < 8; ++j)
|
| 58 | {
|
| 59 | this.blazeSticks[j].rotationPointY = 2.0F + MathHelper.cos(((float)(j * 2) + ageInTicks) * 0.25F);
|
| 60 | this.blazeSticks[j].rotationPointX = MathHelper.cos(f) * 7.0F;
|
| 61 | this.blazeSticks[j].rotationPointZ = MathHelper.sin(f) * 7.0F;
|
| 62 | ++f;
|
| 63 | }
|
| 64 |
|
| 65 | f = 0.47123894F + ageInTicks * (float)Math.PI * -0.05F;
|
| 66 |
|
| 67 | for (int k = 8; k < 12; ++k)
|
| 68 | {
|
| 69 | this.blazeSticks[k].rotationPointY = 11.0F + MathHelper.cos(((float)k * 1.5F + ageInTicks) * 0.5F);
|
| 70 | this.blazeSticks[k].rotationPointX = MathHelper.cos(f) * 5.0F;
|
| 71 | this.blazeSticks[k].rotationPointZ = MathHelper.sin(f) * 5.0F;
|
| 72 | ++f;
|
| 73 | }
|
| 74 |
|
| 75 | this.blazeHead.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
|
| 76 | this.blazeHead.rotateAngleX = headPitch / (180F / (float)Math.PI);
|
| 77 | }
|
| 78 | }
|
| 79 |
|