Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. package botCraft.client;
  2.  
  3. import botCraft.entities.EntityDrillBot;
  4. import net.minecraft.client.model.ModelBase;
  5. import net.minecraft.client.model.ModelRenderer;
  6. import net.minecraft.entity.Entity;
  7.  
  8. public class ModelDrillBot extends ModelBase{
  9. //fields
  10. ModelRenderer Back;
  11. ModelRenderer Front;
  12. private ModelRenderer Drill3;
  13. ModelRenderer Drill2;
  14. ModelRenderer Drill1;
  15. ModelRenderer Locomotion;
  16.  
  17. private int locoType;
  18. private int drill3YCoord;
  19. private int drill2YCoord;
  20. private int drill1YCoord;
  21.  
  22. public ModelDrillBot(int modelLocoType, int modelDrillType){
  23. textureWidth = 64;
  24. textureHeight = 32;
  25.  
  26. switch(modelDrillType) {
  27. case 0:
  28. drill3YCoord = 8;
  29. drill2YCoord = 0;
  30. drill1YCoord = 8;
  31. break;
  32. case 1:
  33. drill3YCoord = 8;
  34. drill2YCoord = 8;
  35. drill1YCoord = 8;
  36. break;
  37. case 2:
  38. drill3YCoord = 0;
  39. drill2YCoord = 0;
  40. drill1YCoord = 0;
  41. break;
  42. default:
  43. drill3YCoord = 0;
  44. drill2YCoord = 0;
  45. drill1YCoord = 0;
  46. }
  47.  
  48. Back = new ModelRenderer(this, 27, 18);
  49. Back.addBox(-4F, -2F, 0F, 8, 5, 9);
  50. Back.setRotationPoint(0F, 0F, 0F);
  51. setRotation(Back, 0F, 0F, 0F);
  52.  
  53. Front = new ModelRenderer(this, 0, 19);
  54. Front.addBox(-4F, -4F, 0F, 8, 8, 5);
  55. Front.setRotationPoint(0F, -1F, -5F);
  56. setRotation(Front, 0F, 0F, 0F);
  57. Back.addChild(Front);
  58.  
  59. Drill3 = new ModelRenderer(this, 20, drill3YCoord);
  60. Drill3.addBox(-3F, -3F, -1F, 6, 6, 2);
  61. Drill3.setRotationPoint(0F, -1F, -6F);
  62. setRotation(Drill3, 0F, 0F, 0F);
  63.  
  64. Drill2 = new ModelRenderer(this, 7, drill2YCoord);
  65. Drill2.addBox(-2F, -2F, -1F, 4, 4, 2);
  66. Drill2.setRotationPoint(0F, -1F, -8F);
  67. setRotation(Drill2, 0F, 0F, 0F);
  68.  
  69. Drill1 = new ModelRenderer(this, 0, drill1YCoord);
  70. Drill1.addBox(-1F, -1F, -1F, 2, 2, 1);
  71. Drill1.setRotationPoint(0F, 0F, -3F);
  72. setRotation(Drill1, 0F, 0F, 0F);
  73. Drill3.addChild(Drill1);
  74.  
  75. switch(modelLocoType) {
  76. case 0:
  77. break;
  78. case 1:
  79. Locomotion = new ModelRenderer(this, 36, 0);
  80. Locomotion.addBox(-5F, 2F, 5F, 2, 3, 3);
  81. Locomotion.addBox(3F, 2F, 5F, 2, 3, 3);
  82. Locomotion.addBox(-5F, 2F, -2F, 2, 3, 3);
  83. Locomotion.addBox(3F, 2F, -2F, 2, 3, 3);
  84. Locomotion.setRotationPoint(0F, 0F, 0F);
  85. setRotation(Locomotion, 0F, 0F, 0F);
  86. locoType = 1;
  87. break;
  88. case 2:
  89. Locomotion = new ModelRenderer(this, 42, 6);
  90. Locomotion.addBox(-5F, 2F, -2F, 2, 3, 9);
  91. Locomotion.addBox(3F, 2F, -2F, 2, 3, 9);
  92. Locomotion.setRotationPoint(0F, 0F, 0F);
  93. setRotation(Locomotion, 0F, 0F, 0F);
  94. locoType = 2;
  95. break;
  96. default:
  97. }
  98. }
  99.  
  100. public void render(Entity entity, float drill3Rotation, float bodyRotation, float f2, float f3, float f4, float f5)
  101. {
  102. EntityDrillBot bot = (EntityDrillBot)entity;
  103.  
  104. Drill3.rotateAngleZ = drill3Rotation;
  105. Drill2.rotateAngleZ = -(drill3Rotation);
  106.  
  107. super.render(entity, drill3Rotation, bodyRotation, f2, f3, f4, f5);
  108.  
  109. setRotationAngles(drill3Rotation, bodyRotation, f2, f3, f4, f5);
  110.  
  111. if(bot != null){
  112. Back.rotateAngleY = bodyRotation;
  113. Drill3.rotateAngleY = bodyRotation;
  114. Drill2.rotateAngleY = bodyRotation;
  115. Locomotion.rotateAngleY = bodyRotation;
  116. }
  117.  
  118. Back.render(f5);
  119. Drill3.render(f5);
  120. Drill2.render(f5);
  121. if(locoType == 1 || locoType == 2) {
  122. Locomotion.render(f5);
  123. }
  124. }
  125.  
  126. private void setRotation(ModelRenderer model, float x, float y, float z)
  127. {
  128. model.rotateAngleX = x;
  129. model.rotateAngleY = y;
  130. model.rotateAngleZ = z;
  131. }
  132.  
  133.  
  134. public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
  135. {
  136.  
  137. super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
  138.  
  139. }
  140.  
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement