| 1 | package net.minecraft.client.model;
|
| 2 |
|
| 3 | import java.util.Random;
|
| 4 | import net.minecraft.client.renderer.GlStateManager;
|
| 5 | import net.minecraft.entity.Entity;
|
| 6 | import net.minecraft.util.MathHelper;
|
| 7 |
|
| 8 | public class ModelGhast extends ModelBase
|
| 9 | {
|
| 10 | ModelRenderer body;
|
| 11 | ModelRenderer[] tentacles = new ModelRenderer[9];
|
| 12 |
|
| 13 | public ModelGhast()
|
| 14 | {
|
| 15 | int i = -16;
|
| 16 | this.body = new ModelRenderer(this, 0, 0);
|
| 17 | this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16);
|
| 18 | this.body.rotationPointY += (float)(24 + i);
|
| 19 | Random random = new Random(1660L);
|
| 20 |
|
| 21 | for (int j = 0; j < this.tentacles.length; ++j)
|
| 22 | {
|
| 23 | this.tentacles[j] = new ModelRenderer(this, 0, 0);
|
| 24 | float f = (((float)(j % 3) - (float)(j / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F;
|
| 25 | float f1 = ((float)(j / 3) / 2.0F * 2.0F - 1.0F) * 5.0F;
|
| 26 | int k = random.nextInt(7) + 8;
|
| 27 | this.tentacles[j].addBox(-1.0F, 0.0F, -1.0F, 2, k, 2);
|
| 28 | this.tentacles[j].rotationPointX = f;
|
| 29 | this.tentacles[j].rotationPointZ = f1;
|
| 30 | this.tentacles[j].rotationPointY = (float)(31 + i);
|
| 31 | }
|
| 32 | }
|
| 33 |
|
| 34 | /**
|
| 35 | * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
|
| 36 | * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
|
| 37 | * "far" arms and legs can swing at most.
|
| 38 | */
|
| 39 | public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
|
| 40 | {
|
| 41 | for (int i = 0; i < this.tentacles.length; ++i)
|
| 42 | {
|
| 43 | this.tentacles[i].rotateAngleX = 0.2F * MathHelper.sin(ageInTicks * 0.3F + (float)i) + 0.4F;
|
| 44 | }
|
| 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 | GlStateManager.pushMatrix();
|
| 54 | GlStateManager.translate(0.0F, 0.6F, 0.0F);
|
| 55 | this.body.render(scale);
|
| 56 |
|
| 57 | for (ModelRenderer modelrenderer : this.tentacles)
|
| 58 | {
|
| 59 | modelrenderer.render(scale);
|
| 60 | }
|
| 61 |
|
| 62 | GlStateManager.popMatrix();
|
| 63 | }
|
| 64 | }
|
| 65 |
|