Guest User

Untitled

a guest
Dec 17th, 2015
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. package jip.jipmod.init.modEntityClasses;
  2.  
  3. import net.minecraft.client.model.ModelBase;
  4. import net.minecraft.client.model.ModelRenderer;
  5. import net.minecraft.client.renderer.GlStateManager;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.util.MathHelper;
  8.  
  9. public class ModelHorror extends ModelBase {
  10.  
  11. ModelRenderer head;
  12. ModelRenderer body;
  13. ModelRenderer rightArm;
  14. ModelRenderer leftArm;
  15.  
  16. public ModelHorror(){
  17. textureWidth = 64;
  18. textureHeight = 64;
  19.  
  20. this.head = new ModelRenderer(this,0,46);
  21. this.head.addBox(-3F, -6F, -4F, 6, 6, 6);
  22. this.head.setRotationPoint(0F, -9F, 0F);
  23.  
  24. this.body = new ModelRenderer(this,32,42);
  25. this.body.addBox(-4F, 0F, -2F, 8, 12, 4);
  26. this.body.setRotationPoint(0F, -9F, 0F);
  27. this.body.setTextureOffset(43, 33).addBox(-3F, 0F, 0F, 6, 3, 3);
  28. this.body.setTextureOffset( 0, 33).addBox(-2F, 0F, -1F, 4, 10, 2);
  29.  
  30. this.leftArm = new ModelRenderer(this,56, 0);
  31. this.leftArm.addBox(-1F, -2F, -1F, 2, 7, 2);
  32. this.leftArm.setRotationPoint(5F, -7F, 0F);
  33. this.leftArm.setTextureOffset( 0, 15).addBox(0F, 0F, 0F, 1, 1, 3);
  34. this.leftArm.setTextureOffset( 0, 15).addBox(0F, 0F, 0F, 1, 1, 3);
  35. this.leftArm.setTextureOffset( 0, 15).addBox(0F, 0F, 0F, 1, 1, 3);
  36. this.leftArm.setTextureOffset( 0, 21).addBox(0F, 2F, -1F, 1, 1, 7);
  37. this.leftArm.setTextureOffset( 13, 34).addBox(0F, 0F, 0F, 1, 1, 8);
  38. this.leftArm.setTextureOffset( 49, 25).addBox(-1F, 0F, 0F, 1, 1, 6);
  39.  
  40. this.rightArm = new ModelRenderer(this,56,0);
  41. this.rightArm.addBox(-1F, -2F, -1F, 2, 7, 2);
  42. this.rightArm.setRotationPoint(-5F, -7F, 0F);
  43. this.rightArm.setTextureOffset( 0, 15).addBox(0F, 0F, 0F, 1, 1, 3);
  44. this.rightArm.setTextureOffset( 0, 15).addBox(0F, 0F, 0F, 1, 1, 3);
  45. this.rightArm.setTextureOffset( 0, 15).addBox(-2F, 0F, 0F, 1, 1, 3);
  46. this.rightArm.setTextureOffset( 0, 21).addBox(-1F, 0F, 0F, 1, 1, 7);
  47. this.rightArm.setTextureOffset( 0, 7).addBox(0F, 0F, 0F, 1, 1, 5);
  48. this.rightArm.setTextureOffset( 0, 0).addBox(-1F, 0F, -1F, 1, 1, 5);
  49.  
  50. }
  51.  
  52. public void render(Entity entity, float time, float limbSwingDistance, float p_78088_4_, float headYRot, float headXRot, float yTrans) {
  53. this.setRotationAngles(time, limbSwingDistance, p_78088_4_, headYRot, headXRot, yTrans, entity);
  54.  
  55. if(this.isChild){
  56. float div = 2.0F;
  57. GlStateManager.pushMatrix();
  58. GlStateManager.scale(1.0F/div, 1.0F/div, 1.0F/div);
  59. GlStateManager.translate(0.0F, 24.0F * yTrans, 0.0F );
  60.  
  61. this.head.render(yTrans);
  62. this.body.render(yTrans);
  63. this.leftArm.render(yTrans);
  64. this.rightArm.render(yTrans);
  65.  
  66. GlStateManager.popMatrix();
  67. }
  68. else{
  69. this.head.render(yTrans);
  70. this.body.render(yTrans);
  71. this.leftArm.render(yTrans);
  72. this.rightArm.render(yTrans);
  73. }
  74. }
  75.  
  76. public void setRotationAngles(float time, float limbSwingDistance, float p_78087_3_, float headYRot, float headXRot, float p_78087_6_, Entity entity) {
  77.  
  78. this.head.rotateAngleX = headXRot/(180F / (float)Math.PI);
  79. this.head.rotateAngleY = headYRot/(180F / (float)Math.PI);
  80.  
  81. this.body.rotateAngleX = ((float)Math.PI/2.0F);
  82.  
  83. this.leftArm.rotateAngleX = MathHelper.cos(time * 0.662F + (float)Math.PI) * 1.4F * limbSwingDistance;
  84. this.rightArm.rotateAngleX = MathHelper.cos(time * 0.662F) * 1.4F * limbSwingDistance;
  85. }
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment