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