001 package net.minecraft.src; 002 003 import cpw.mods.fml.common.Side; 004 import cpw.mods.fml.common.asm.SideOnly; 005 import org.lwjgl.opengl.GL11; 006 007 @SideOnly(Side.CLIENT) 008 public class ModelOcelot extends ModelBase 009 { 010 ModelRenderer field_78161_a; 011 ModelRenderer field_78159_b; 012 ModelRenderer field_78160_c; 013 ModelRenderer field_78157_d; 014 ModelRenderer field_78158_e; 015 ModelRenderer field_78155_f; 016 ModelRenderer field_78156_g; 017 ModelRenderer field_78162_h; 018 int field_78163_i = 1; 019 020 public ModelOcelot() 021 { 022 this.setTextureOffset("head.main", 0, 0); 023 this.setTextureOffset("head.nose", 0, 24); 024 this.setTextureOffset("head.ear1", 0, 10); 025 this.setTextureOffset("head.ear2", 6, 10); 026 this.field_78156_g = new ModelRenderer(this, "head"); 027 this.field_78156_g.addBox("main", -2.5F, -2.0F, -3.0F, 5, 4, 5); 028 this.field_78156_g.addBox("nose", -1.5F, 0.0F, -4.0F, 3, 2, 2); 029 this.field_78156_g.addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2); 030 this.field_78156_g.addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2); 031 this.field_78156_g.setRotationPoint(0.0F, 15.0F, -9.0F); 032 this.field_78162_h = new ModelRenderer(this, 20, 0); 033 this.field_78162_h.addBox(-2.0F, 3.0F, -8.0F, 4, 16, 6, 0.0F); 034 this.field_78162_h.setRotationPoint(0.0F, 12.0F, -10.0F); 035 this.field_78158_e = new ModelRenderer(this, 0, 15); 036 this.field_78158_e.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1); 037 this.field_78158_e.rotateAngleX = 0.9F; 038 this.field_78158_e.setRotationPoint(0.0F, 15.0F, 8.0F); 039 this.field_78155_f = new ModelRenderer(this, 4, 15); 040 this.field_78155_f.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1); 041 this.field_78155_f.setRotationPoint(0.0F, 20.0F, 14.0F); 042 this.field_78161_a = new ModelRenderer(this, 8, 13); 043 this.field_78161_a.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2); 044 this.field_78161_a.setRotationPoint(1.1F, 18.0F, 5.0F); 045 this.field_78159_b = new ModelRenderer(this, 8, 13); 046 this.field_78159_b.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2); 047 this.field_78159_b.setRotationPoint(-1.1F, 18.0F, 5.0F); 048 this.field_78160_c = new ModelRenderer(this, 40, 0); 049 this.field_78160_c.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2); 050 this.field_78160_c.setRotationPoint(1.2F, 13.8F, -5.0F); 051 this.field_78157_d = new ModelRenderer(this, 40, 0); 052 this.field_78157_d.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2); 053 this.field_78157_d.setRotationPoint(-1.2F, 13.8F, -5.0F); 054 } 055 056 /** 057 * Sets the models various rotation angles then renders the model. 058 */ 059 public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) 060 { 061 this.setRotationAngles(par2, par3, par4, par5, par6, par7); 062 063 if (this.isChild) 064 { 065 float var8 = 2.0F; 066 GL11.glPushMatrix(); 067 GL11.glScalef(1.5F / var8, 1.5F / var8, 1.5F / var8); 068 GL11.glTranslatef(0.0F, 10.0F * par7, 4.0F * par7); 069 this.field_78156_g.render(par7); 070 GL11.glPopMatrix(); 071 GL11.glPushMatrix(); 072 GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); 073 GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); 074 this.field_78162_h.render(par7); 075 this.field_78161_a.render(par7); 076 this.field_78159_b.render(par7); 077 this.field_78160_c.render(par7); 078 this.field_78157_d.render(par7); 079 this.field_78158_e.render(par7); 080 this.field_78155_f.render(par7); 081 GL11.glPopMatrix(); 082 } 083 else 084 { 085 this.field_78156_g.render(par7); 086 this.field_78162_h.render(par7); 087 this.field_78158_e.render(par7); 088 this.field_78155_f.render(par7); 089 this.field_78161_a.render(par7); 090 this.field_78159_b.render(par7); 091 this.field_78160_c.render(par7); 092 this.field_78157_d.render(par7); 093 } 094 } 095 096 /** 097 * Sets the models various rotation angles. 098 */ 099 public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) 100 { 101 this.field_78156_g.rotateAngleX = par5 / (180F / (float)Math.PI); 102 this.field_78156_g.rotateAngleY = par4 / (180F / (float)Math.PI); 103 104 if (this.field_78163_i != 3) 105 { 106 this.field_78162_h.rotateAngleX = ((float)Math.PI / 2F); 107 108 if (this.field_78163_i == 2) 109 { 110 this.field_78161_a.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.0F * par2; 111 this.field_78159_b.rotateAngleX = MathHelper.cos(par1 * 0.6662F + 0.3F) * 1.0F * par2; 112 this.field_78160_c.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI + 0.3F) * 1.0F * par2; 113 this.field_78157_d.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; 114 this.field_78155_f.rotateAngleX = 1.7278761F + ((float)Math.PI / 10F) * MathHelper.cos(par1) * par2; 115 } 116 else 117 { 118 this.field_78161_a.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.0F * par2; 119 this.field_78159_b.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; 120 this.field_78160_c.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; 121 this.field_78157_d.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.0F * par2; 122 123 if (this.field_78163_i == 1) 124 { 125 this.field_78155_f.rotateAngleX = 1.7278761F + ((float)Math.PI / 4F) * MathHelper.cos(par1) * par2; 126 } 127 else 128 { 129 this.field_78155_f.rotateAngleX = 1.7278761F + 0.47123894F * MathHelper.cos(par1) * par2; 130 } 131 } 132 } 133 } 134 135 /** 136 * Used for easily adding entity-dependent animations. The second and third float params here are the same second 137 * and third as in the setRotationAngles method. 138 */ 139 public void setLivingAnimations(EntityLiving par1EntityLiving, float par2, float par3, float par4) 140 { 141 EntityOcelot var5 = (EntityOcelot)par1EntityLiving; 142 this.field_78162_h.rotationPointY = 12.0F; 143 this.field_78162_h.rotationPointZ = -10.0F; 144 this.field_78156_g.rotationPointY = 15.0F; 145 this.field_78156_g.rotationPointZ = -9.0F; 146 this.field_78158_e.rotationPointY = 15.0F; 147 this.field_78158_e.rotationPointZ = 8.0F; 148 this.field_78155_f.rotationPointY = 20.0F; 149 this.field_78155_f.rotationPointZ = 14.0F; 150 this.field_78160_c.rotationPointY = this.field_78157_d.rotationPointY = 13.8F; 151 this.field_78160_c.rotationPointZ = this.field_78157_d.rotationPointZ = -5.0F; 152 this.field_78161_a.rotationPointY = this.field_78159_b.rotationPointY = 18.0F; 153 this.field_78161_a.rotationPointZ = this.field_78159_b.rotationPointZ = 5.0F; 154 this.field_78158_e.rotateAngleX = 0.9F; 155 156 if (var5.isSneaking()) 157 { 158 ++this.field_78162_h.rotationPointY; 159 this.field_78156_g.rotationPointY += 2.0F; 160 ++this.field_78158_e.rotationPointY; 161 this.field_78155_f.rotationPointY += -4.0F; 162 this.field_78155_f.rotationPointZ += 2.0F; 163 this.field_78158_e.rotateAngleX = ((float)Math.PI / 2F); 164 this.field_78155_f.rotateAngleX = ((float)Math.PI / 2F); 165 this.field_78163_i = 0; 166 } 167 else if (var5.isSprinting()) 168 { 169 this.field_78155_f.rotationPointY = this.field_78158_e.rotationPointY; 170 this.field_78155_f.rotationPointZ += 2.0F; 171 this.field_78158_e.rotateAngleX = ((float)Math.PI / 2F); 172 this.field_78155_f.rotateAngleX = ((float)Math.PI / 2F); 173 this.field_78163_i = 2; 174 } 175 else if (var5.isSitting()) 176 { 177 this.field_78162_h.rotateAngleX = ((float)Math.PI / 4F); 178 this.field_78162_h.rotationPointY += -4.0F; 179 this.field_78162_h.rotationPointZ += 5.0F; 180 this.field_78156_g.rotationPointY += -3.3F; 181 ++this.field_78156_g.rotationPointZ; 182 this.field_78158_e.rotationPointY += 8.0F; 183 this.field_78158_e.rotationPointZ += -2.0F; 184 this.field_78155_f.rotationPointY += 2.0F; 185 this.field_78155_f.rotationPointZ += -0.8F; 186 this.field_78158_e.rotateAngleX = 1.7278761F; 187 this.field_78155_f.rotateAngleX = 2.670354F; 188 this.field_78160_c.rotateAngleX = this.field_78157_d.rotateAngleX = -0.15707964F; 189 this.field_78160_c.rotationPointY = this.field_78157_d.rotationPointY = 15.8F; 190 this.field_78160_c.rotationPointZ = this.field_78157_d.rotationPointZ = -7.0F; 191 this.field_78161_a.rotateAngleX = this.field_78159_b.rotateAngleX = -((float)Math.PI / 2F); 192 this.field_78161_a.rotationPointY = this.field_78159_b.rotationPointY = 21.0F; 193 this.field_78161_a.rotationPointZ = this.field_78159_b.rotationPointZ = 1.0F; 194 this.field_78163_i = 3; 195 } 196 else 197 { 198 this.field_78163_i = 1; 199 } 200 } 201 }