001 package net.minecraft.client.model; 002 003 import cpw.mods.fml.relauncher.Side; 004 import cpw.mods.fml.relauncher.SideOnly; 005 import java.util.Random; 006 import net.minecraft.entity.Entity; 007 import net.minecraft.util.MathHelper; 008 import org.lwjgl.opengl.GL11; 009 010 @SideOnly(Side.CLIENT) 011 public class ModelGhast extends ModelBase 012 { 013 ModelRenderer body; 014 ModelRenderer[] tentacles = new ModelRenderer[9]; 015 016 public ModelGhast() 017 { 018 byte var1 = -16; 019 this.body = new ModelRenderer(this, 0, 0); 020 this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16); 021 this.body.rotationPointY += (float)(24 + var1); 022 Random var2 = new Random(1660L); 023 024 for (int var3 = 0; var3 < this.tentacles.length; ++var3) 025 { 026 this.tentacles[var3] = new ModelRenderer(this, 0, 0); 027 float var4 = (((float)(var3 % 3) - (float)(var3 / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F; 028 float var5 = ((float)(var3 / 3) / 2.0F * 2.0F - 1.0F) * 5.0F; 029 int var6 = var2.nextInt(7) + 8; 030 this.tentacles[var3].addBox(-1.0F, 0.0F, -1.0F, 2, var6, 2); 031 this.tentacles[var3].rotationPointX = var4; 032 this.tentacles[var3].rotationPointZ = var5; 033 this.tentacles[var3].rotationPointY = (float)(31 + var1); 034 } 035 } 036 037 /** 038 * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms 039 * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how 040 * "far" arms and legs can swing at most. 041 */ 042 public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) 043 { 044 for (int var8 = 0; var8 < this.tentacles.length; ++var8) 045 { 046 this.tentacles[var8].rotateAngleX = 0.2F * MathHelper.sin(par3 * 0.3F + (float)var8) + 0.4F; 047 } 048 } 049 050 /** 051 * Sets the models various rotation angles then renders the model. 052 */ 053 public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) 054 { 055 this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); 056 GL11.glPushMatrix(); 057 GL11.glTranslatef(0.0F, 0.6F, 0.0F); 058 this.body.render(par7); 059 ModelRenderer[] var8 = this.tentacles; 060 int var9 = var8.length; 061 062 for (int var10 = 0; var10 < var9; ++var10) 063 { 064 ModelRenderer var11 = var8[var10]; 065 var11.render(par7); 066 } 067 068 GL11.glPopMatrix(); 069 } 070 }