Advertisement
Guest User

ModelChapeau

a guest
Jan 28th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. // Date: 29/11/2014 22:25:38
  2. // Template version 1.1
  3. // Java generated by Techne
  4. // Keep in mind that you still need to fill in some blanks
  5. // - ZeuX
  6.  
  7. package fr.yannblanc.aliceadsl.agriculcraft.client.render;
  8.  
  9. import net.minecraft.client.model.ModelBiped;
  10. import net.minecraft.client.model.ModelRenderer;
  11. import net.minecraft.entity.Entity;
  12. import net.minecraft.entity.EntityLivingBase;
  13.  
  14. import org.lwjgl.opengl.GL11;
  15.  
  16. public class ModelChapeau extends ModelBiped
  17. {
  18. // fields
  19. ModelRenderer chapeaubas;
  20. ModelRenderer chapeauhaut;
  21.  
  22. public ModelChapeau()
  23. {
  24. textureWidth = 128;
  25. textureHeight = 64;
  26.  
  27. chapeaubas = new ModelRenderer(this, 80, 0);
  28. chapeaubas.addBox(-6F, -0.5F, -6F, 12, 1, 12);
  29. chapeaubas.setRotationPoint(0F, -8.5F, 0F);
  30. chapeaubas.setTextureSize(128, 64);
  31. chapeaubas.mirror = true;
  32. setRotation(chapeaubas, 0F, 0F, 0F);
  33. chapeauhaut = new ModelRenderer(this, 90, 17);
  34. chapeauhaut.addBox(-4F, -2F, -4F, 8, 2, 8);
  35. chapeauhaut.setRotationPoint(0F, -9F, 0F);
  36. chapeauhaut.setTextureSize(128, 64);
  37. chapeauhaut.mirror = true;
  38. setRotation(chapeauhaut, 0F, 0F, 0F);
  39. }
  40.  
  41. public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  42. {
  43. super.render(entity, f, f1, f2, f3, f4, f5);
  44. setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  45. chapeaubas.render(f5);
  46. chapeauhaut.render(f5);
  47.  
  48. }
  49.  
  50. private void setRotation(ModelRenderer model, float x, float y, float z)
  51. {
  52. model.rotateAngleX = x;
  53. model.rotateAngleY = y;
  54. model.rotateAngleZ = z;
  55. }
  56.  
  57. public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
  58. {
  59. super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  60. this.chapeauhaut.rotateAngleY = f3 / (180F / (float)Math.PI);
  61. this.chapeauhaut.rotateAngleX = f4 / (180F / (float)Math.PI);
  62. this.chapeaubas.rotateAngleY = f3 / (180F / (float)Math.PI);
  63. this.chapeaubas.rotateAngleX = f4 / (180F / (float)Math.PI);
  64. this.chapeauhaut.rotateAngleZ = f5 / (180F / (float)Math.PI);
  65. this.chapeaubas.rotateAngleZ = f5 / (180F / (float)Math.PI);
  66.  
  67. }
  68.  
  69. public void setLivingAnimations(EntityLivingBase ent, float x, float y, float z, float partialTime)
  70. {
  71. super.setRotationAngles(0, 0, 0, x * (180f / (float)Math.PI), y * (180f / (float)Math.PI), z * (180f / (float)Math.PI), ent);
  72. }
  73.  
  74. public void render1(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
  75. {
  76. if(par1Entity instanceof EntityLivingBase)
  77. {
  78. EntityLivingBase entity = (EntityLivingBase)par1Entity;
  79. GL11.glPushMatrix();
  80. float y = 1.5f;
  81. if(entity.isSneaking())
  82. y = 1.53f;
  83. GL11.glRotated(180, 0.0D, 0.0D, 1.0D);
  84. GL11.glRotated(180, 0.0d, 1.0d, 0.0d);
  85. GL11.glTranslatef(0.0f, -y, 0.0f);
  86. GL11.glScalef(0.045f, 0.045f, 0.045f);
  87. float factor = 1f / 0.045f;
  88.  
  89. GL11.glTranslated(0.0d, 1.5f * factor, 0.0f);
  90.  
  91. GL11.glRotated(-par5, 0.0f, 1.0f, 0.0f);
  92.  
  93. GL11.glTranslated(0.0d, -y * factor, 0.0f);
  94.  
  95. GL11.glTranslated(0.0d, y * factor, 0.0f);
  96. GL11.glRotatef(par6, 1.0f, 0.0f, 0.0f);
  97. GL11.glTranslated(0.0d, -y * factor, 0.0f);
  98.  
  99. GL11.glShadeModel(GL11.GL_SMOOTH);
  100. this.render(par1Entity, factor, factor, factor, factor, factor, factor);
  101. GL11.glPopMatrix();
  102. }
  103. }
  104. private float interpolateRotation(float par1, float par2, float par3)
  105. {
  106. float f3;
  107.  
  108.  
  109. for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
  110. {
  111. ;
  112. }
  113.  
  114.  
  115. while (f3 >= 180.0F)
  116. {
  117. f3 -= 360.0F;
  118. }
  119.  
  120.  
  121. return par1 + par3 * f3;
  122. }
  123.  
  124. public static void render()
  125. {
  126. // TODO Auto-generated method stub
  127.  
  128. }
  129. public void setLivingAnimations(EntityLivingBase ent, float x, float y, float partialTime)
  130. {
  131. super.setRotationAngles(0,0,0,x*(180f/(float)Math.PI),y*(180f/(float)Math.PI),0.0625F, ent);
  132. }
  133.  
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement