Advertisement
Guest User

Untitled

a guest
Aug 9th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.17 KB | None | 0 0
  1. public class ThaumicGenRenderer extends TileEntitySpecialRenderer {
  2.  
  3.  
  4. private static final ResourceLocation TEX = new ResourceLocation(Knowledge.MODID+":"+"textures/models/ThaumicGen_model.png");
  5.  
  6. private ModelThaumicGen model;
  7.  
  8. public ThaumicGenRenderer() {
  9. this.model = new ModelThaumicGen();
  10. }
  11.  
  12. @Override
  13. public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
  14.  
  15.  
  16. GL11.glPushMatrix();
  17. GL11.glTranslatef((float)x, (float)y, (float)z);
  18. GL11.glRotatef(0F, 0, 0, 0);
  19. GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
  20. GL11.glEnable(GL11.GL_BLEND);
  21. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  22. TileEntityThaumicGen t = (TileEntityThaumicGen)te;
  23. renderBlockYour(t, t.getWorldObj(), t.xCoord, t.yCoord, t.zCoord, TKBlocks.dummytg);
  24. GL11.glDisable(GL11.GL_BLEND);
  25. GL11.glPopMatrix();
  26.  
  27. }
  28.  
  29. private void renderBlockYour(TileEntityThaumicGen te, World world, int i, int j, int k, Block block) {
  30. TileEntityThaumicGen t = (TileEntityThaumicGen)te;
  31. Tessellator tessellator = Tessellator.instance;
  32. float f = block.getLightValue(world, i, j, k);
  33. int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
  34. int l1 = l % 65536;
  35. int l2 = l / 65536;
  36. tessellator.setColorOpaque_F(f, f, f);//System.out.println(t.getFacing().ordinal());
  37. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);
  38. int dir = world.getBlockMetadata(i, j, k);
  39. switch(t.getFacing().ordinal()) {
  40. case 2:
  41. GL11.glRotatef(180, 0, 1, 0);
  42. GL11.glTranslatef(0F, -1.5F, 1F); // +0.5, -0.5, +1
  43. break;
  44. case 3:
  45. GL11.glRotatef(0, 0, 1, 0);
  46. GL11.glTranslatef(1F, -1.5F, 0F);
  47. break;
  48. case 4:
  49. GL11.glRotatef(90, 0, 1, 0);
  50. GL11.glTranslatef(1F, -1.5F, 1F);
  51. break;
  52. case 5:
  53. GL11.glRotatef(270, 0F, 1F, 0F);
  54. GL11.glTranslatef(0F, -1.5F, 0F);
  55. break;
  56. default:
  57. }
  58. GL11.glRotatef(dir * (-90F), 0F, 1F, 0F);
  59. GL11.glTranslatef(-0.5F, 0F, -0.5F);
  60. Minecraft.getMinecraft().renderEngine.bindTexture(TEX);
  61. this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
  62. this.model.renderGlass((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
  63.  
  64. }
  65.  
  66. }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. public class ModelThaumicGen extends ModelBase {
  83. public ModelRenderer Jar;
  84. public ModelRenderer Top;
  85. public ModelRenderer Bottom;
  86. public ModelRenderer JarInside;
  87. public ModelRenderer CoilA;
  88. public ModelRenderer CoilB;
  89. public ModelRenderer CoilC;
  90. public ModelRenderer CoilD;
  91. public ModelRenderer CoilA_1;
  92. public ModelRenderer CoilB_1;
  93. public ModelRenderer CoilC_1;
  94. public ModelRenderer CoilD_1;
  95. public ModelRenderer ConnectorA;
  96. public ModelRenderer ConnectorB;
  97. public ModelRenderer ConnectorC;
  98. public ModelRenderer ConnectorD;
  99. public ModelRenderer TrimFBA;
  100. public ModelRenderer TrimFBB;
  101. public ModelRenderer TrimFBC;
  102. public ModelRenderer TrimFBD;
  103. public ModelRenderer TrimLRC;
  104. public ModelRenderer TrimLRD;
  105. public ModelRenderer TrimLRA;
  106. public ModelRenderer TrimLRB;
  107. public ModelRenderer TrimTDA;
  108. public ModelRenderer TrimTDB;
  109. public ModelRenderer TrimTDC;
  110. public ModelRenderer TrimTDD;
  111. public ModelRenderer ConnectorA_1;
  112. public ModelRenderer ConnectorB_1;
  113. public ModelRenderer ConnectorC_1;
  114. public ModelRenderer ConnectorD_1;
  115.  
  116. public ModelThaumicGen() {
  117. this.textureWidth = 64;
  118. this.textureHeight = 64;
  119. this.ConnectorA = new ModelRenderer(this, 0, 17);
  120. this.ConnectorA.setRotationPoint(-7.0F, 18.0F, 0.0F);
  121. this.ConnectorA.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
  122. this.setRotateAngle(ConnectorA, 0.0F, 0.0F, -0.19198621771937624F);
  123. this.TrimFBC = new ModelRenderer(this, 60, 43);
  124. this.TrimFBC.setRotationPoint(7.0F, -2.0F, -7.0F);
  125. this.TrimFBC.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
  126. this.setRotateAngle(TrimFBC, 1.5707963267948966F, 0.0F, 0.0F);
  127. this.CoilC = new ModelRenderer(this, 56, 20);
  128. this.CoilC.setRotationPoint(-3.3F, -5.000000000000003F, 3.3F);
  129. this.CoilC.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F);
  130. this.setRotateAngle(CoilC, -0.19198621771937624F, 0.0F, -0.19198621771937624F);
  131. this.CoilB = new ModelRenderer(this, 56, 20);
  132. this.CoilB.setRotationPoint(-3.3F, -5.000000000000003F, -3.3F);
  133. this.CoilB.addBox(-2.0F, 0.0F, -2.0F, 2, 3, 2, 0.0F);
  134. this.setRotateAngle(CoilB, 0.19198621771937624F, 0.0F, -0.19198621771937624F);
  135. this.Bottom = new ModelRenderer(this, 0, 0);
  136. this.Bottom.setRotationPoint(0.0F, 24.0F, 0.0F);
  137. this.Bottom.addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12, 0.0F);
  138. this.setRotateAngle(Bottom, 0.0F, 0.0F, 3.141592653589793F);
  139. this.TrimTDC = new ModelRenderer(this, 60, 43);
  140. this.TrimTDC.setRotationPoint(7.0F, -2.0F, 6.0F);
  141. this.TrimTDC.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
  142. this.Jar = new ModelRenderer(this, 0, 32);
  143. this.Jar.setRotationPoint(0.0F, -2.4F, 0.0F);
  144. this.Jar.addBox(-6.0F, 0.0F, -6.0F, 12, 20, 12, 0.0F);
  145. this.TrimFBA = new ModelRenderer(this, 60, 43);
  146. this.TrimFBA.setRotationPoint(-6.0F, -2.0F, -7.0F);
  147. this.TrimFBA.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
  148. this.setRotateAngle(TrimFBA, 1.5707963267948966F, 0.0F, 0.0F);
  149. this.TrimTDA = new ModelRenderer(this, 60, 43);
  150. this.TrimTDA.setRotationPoint(-6.0F, -2.0F, 6.0F);
  151. this.TrimTDA.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
  152. this.CoilD = new ModelRenderer(this, 56, 20);
  153. this.CoilD.setRotationPoint(3.3F, -5.000000000000003F, -3.3F);
  154. this.CoilD.addBox(0.0F, 0.0F, -2.0F, 2, 3, 2, 0.0F);
  155. this.setRotateAngle(CoilD, 0.19198621771937624F, 0.0F, 0.19198621771937624F);
  156. this.CoilD_1 = new ModelRenderer(this, 56, 29);
  157. this.CoilD_1.setRotationPoint(3.0F, -1.0F, -2.0F);
  158. this.CoilD_1.addBox(0.0F, -1.4F, -2.0F, 1, 3, 1, 0.0F);
  159. this.setRotateAngle(CoilD_1, 0.19198621771937624F, 0.0F, 0.19198621771937624F);
  160. this.CoilA = new ModelRenderer(this, 56, 20);
  161. this.CoilA.setRotationPoint(3.3F, -5.000000000000003F, 3.3F);
  162. this.CoilA.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F);
  163. this.setRotateAngle(CoilA, -0.19198621771937624F, 0.0F, 0.19198621771937624F);
  164. this.TrimFBB = new ModelRenderer(this, 60, 43);
  165. this.TrimFBB.setRotationPoint(-6.0F, 19.0F, -7.0F);
  166. this.TrimFBB.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
  167. this.setRotateAngle(TrimFBB, 1.5707963267948966F, 0.0F, 0.0F);
  168. this.ConnectorD = new ModelRenderer(this, 18, 21);
  169. this.ConnectorD.setRotationPoint(0.0F, 18.0F, -7.0F);
  170. this.ConnectorD.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
  171. this.setRotateAngle(ConnectorD, 0.19198621771937624F, 0.0F, 0.0F);
  172. this.JarInside = new ModelRenderer(this, 28, 0);
  173. this.JarInside.setRotationPoint(0.0F, 10.2F, 0.0F);
  174. this.JarInside.addBox(-6.0F, 0.0F, -6.0F, 12, 0, 12, 0.0F);
  175. this.ConnectorA_1 = new ModelRenderer(this, 0, 17);
  176. this.ConnectorA_1.setRotationPoint(-7.0F, -1.9999999999999791F, 0.0F);
  177. this.ConnectorA_1.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
  178. this.setRotateAngle(ConnectorA_1, 0.0F, 0.0F, -2.949606435870417F);
  179. this.TrimLRA = new ModelRenderer(this, 60, 43);
  180. this.TrimLRA.setRotationPoint(-6.0F, -2.0F, -7.0F);
  181. this.TrimLRA.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
  182. this.setRotateAngle(TrimLRA, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
  183. this.TrimLRD = new ModelRenderer(this, 60, 43);
  184. this.TrimLRD.setRotationPoint(-6.0F, 19.0F, -7.0F);
  185. this.TrimLRD.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
  186. this.setRotateAngle(TrimLRD, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
  187. this.CoilB_1 = new ModelRenderer(this, 56, 29);
  188. this.CoilB_1.setRotationPoint(-2.0F, -1.0F, -2.0F);
  189. this.CoilB_1.addBox(-2.0F, -1.4F, -2.0F, 1, 3, 1, 0.0F);
  190. this.setRotateAngle(CoilB_1, 0.19198621771937624F, 0.0F, -0.19198621771937624F);
  191. this.CoilC_1 = new ModelRenderer(this, 56, 29);
  192. this.CoilC_1.setRotationPoint(-2.0F, -1.0F, 3.0F);
  193. this.CoilC_1.addBox(-2.0F, -1.4F, 0.0F, 1, 3, 1, 0.0F);
  194. this.setRotateAngle(CoilC_1, -0.19198621771937624F, 0.0F, -0.19198621771937624F);
  195. this.TrimTDD = new ModelRenderer(this, 60, 43);
  196. this.TrimTDD.mirror = true;
  197. this.TrimTDD.setRotationPoint(7.0F, -2.0F, -7.0F);
  198. this.TrimTDD.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
  199. this.ConnectorC = new ModelRenderer(this, 18, 21);
  200. this.ConnectorC.setRotationPoint(0.0F, 18.0F, 7.0F);
  201. this.ConnectorC.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
  202. this.setRotateAngle(ConnectorC, -0.19198621771937624F, 0.0F, 0.0F);
  203. this.TrimLRB = new ModelRenderer(this, 60, 43);
  204. this.TrimLRB.setRotationPoint(-6.0F, -2.0F, 6.0F);
  205. this.TrimLRB.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
  206. this.setRotateAngle(TrimLRB, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
  207. this.ConnectorC_1 = new ModelRenderer(this, 18, 21);
  208. this.ConnectorC_1.setRotationPoint(0.0F, -1.9999999999999791F, 7.0F);
  209. this.ConnectorC_1.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
  210. this.setRotateAngle(ConnectorC_1, -0.19198621771937624F, 0.0F, 3.141592653589793F);
  211. this.Top = new ModelRenderer(this, 0, 0);
  212. this.Top.setRotationPoint(0.0F, -8.0F, 0.0F);
  213. this.Top.addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12, 0.0F);
  214. this.ConnectorB_1 = new ModelRenderer(this, 0, 17);
  215. this.ConnectorB_1.setRotationPoint(7.0F, -1.9999999999999791F, 0.0F);
  216. this.ConnectorB_1.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
  217. this.setRotateAngle(ConnectorB_1, 0.0F, 0.0F, 2.949606435870417F);
  218. this.TrimTDB = new ModelRenderer(this, 60, 43);
  219. this.TrimTDB.setRotationPoint(-6.0F, -2.0F, -7.0F);
  220. this.TrimTDB.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
  221. this.ConnectorB = new ModelRenderer(this, 0, 17);
  222. this.ConnectorB.setRotationPoint(7.0F, 18.0F, 0.0F);
  223. this.ConnectorB.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
  224. this.setRotateAngle(ConnectorB, 0.0F, 0.0F, 0.19198621771937624F);
  225. this.TrimLRC = new ModelRenderer(this, 60, 43);
  226. this.TrimLRC.setRotationPoint(-6.0F, 19.0F, 6.0F);
  227. this.TrimLRC.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
  228. this.setRotateAngle(TrimLRC, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
  229. this.CoilA_1 = new ModelRenderer(this, 56, 29);
  230. this.CoilA_1.setRotationPoint(3.0F, -1.0F, 3.0F);
  231. this.CoilA_1.addBox(0.0F, -1.4F, 0.0F, 1, 3, 1, 0.0F);
  232. this.setRotateAngle(CoilA_1, -0.19198621771937624F, 0.0F, 0.19198621771937624F);
  233. this.ConnectorD_1 = new ModelRenderer(this, 18, 21);
  234. this.ConnectorD_1.setRotationPoint(0.0F, -1.9999999999999791F, -7.0F);
  235. this.ConnectorD_1.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
  236. this.setRotateAngle(ConnectorD_1, 0.19198621771937624F, 0.0F, 3.141592653589793F);
  237. this.TrimFBD = new ModelRenderer(this, 60, 43);
  238. this.TrimFBD.setRotationPoint(7.0F, 19.0F, -7.0F);
  239. this.TrimFBD.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
  240. this.setRotateAngle(TrimFBD, 1.5707963267948966F, 0.0F, 0.0F);
  241. }
  242.  
  243. @Override
  244. public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
  245. this.ConnectorA.render(f5);
  246. this.TrimFBC.render(f5);
  247. this.CoilC.render(f5);
  248. this.CoilB.render(f5);
  249. this.Bottom.render(f5);
  250. this.TrimTDC.render(f5);
  251. /*GL11.glPushMatrix();
  252. GL11.glTranslatef(this.Jar.offsetX, this.Jar.offsetY, this.Jar.offsetZ);
  253. GL11.glTranslatef(this.Jar.rotationPointX * f5, this.Jar.rotationPointY * f5, this.Jar.rotationPointZ * f5);
  254. GL11.glScaled(1.07D, 1.04D, 1.07D);
  255. GL11.glTranslatef(-this.Jar.offsetX, -this.Jar.offsetY, -this.Jar.offsetZ);
  256. GL11.glTranslatef(-this.Jar.rotationPointX * f5, -this.Jar.rotationPointY * f5, -this.Jar.rotationPointZ * f5);
  257. this.Jar.render(f5);
  258. GL11.glPopMatrix();*/
  259. this.TrimFBA.render(f5);
  260. this.TrimTDA.render(f5);
  261. this.CoilD.render(f5);
  262. this.CoilD_1.render(f5);
  263. this.CoilA.render(f5);
  264. this.TrimFBB.render(f5);
  265. this.ConnectorD.render(f5);
  266. /*GL11.glPushMatrix();
  267. GL11.glTranslatef(this.JarInside.offsetX, this.JarInside.offsetY, this.JarInside.offsetZ);
  268. GL11.glTranslatef(this.JarInside.rotationPointX * f5, this.JarInside.rotationPointY * f5, this.JarInside.rotationPointZ * f5);
  269. GL11.glScaled(1.07D, 1.0D, 1.07D);
  270. GL11.glTranslatef(-this.JarInside.offsetX, -this.JarInside.offsetY, -this.JarInside.offsetZ);
  271. GL11.glTranslatef(-this.JarInside.rotationPointX * f5, -this.JarInside.rotationPointY * f5, -this.JarInside.rotationPointZ * f5);
  272. this.JarInside.render(f5);
  273. GL11.glPopMatrix();*/
  274. this.ConnectorA_1.render(f5);
  275. this.TrimLRA.render(f5);
  276. this.TrimLRD.render(f5);
  277. this.CoilB_1.render(f5);
  278. this.CoilC_1.render(f5);
  279. this.TrimTDD.render(f5);
  280. this.ConnectorC.render(f5);
  281. this.TrimLRB.render(f5);
  282. this.ConnectorC_1.render(f5);
  283. this.Top.render(f5);
  284. this.ConnectorB_1.render(f5);
  285. this.TrimTDB.render(f5);
  286. this.ConnectorB.render(f5);
  287. this.TrimLRC.render(f5);
  288. this.CoilA_1.render(f5);
  289. this.ConnectorD_1.render(f5);
  290. this.TrimFBD.render(f5);
  291.  
  292. }
  293.  
  294.  
  295. public void renderFloor(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
  296.  
  297. GL11.glPushMatrix();
  298. GL11.glTranslatef(this.JarInside.offsetX, this.JarInside.offsetY, this.JarInside.offsetZ);
  299. GL11.glTranslatef(this.JarInside.rotationPointX * f5, this.JarInside.rotationPointY * f5, this.JarInside.rotationPointZ * f5);
  300. GL11.glScaled(1.07D, 1.0D, 1.07D);
  301. GL11.glTranslatef(-this.JarInside.offsetX, -this.JarInside.offsetY, -this.JarInside.offsetZ);
  302. GL11.glTranslatef(-this.JarInside.rotationPointX * f5, -this.JarInside.rotationPointY * f5, -this.JarInside.rotationPointZ * f5);
  303. this.JarInside.render(f5);
  304. GL11.glPopMatrix();
  305. }
  306.  
  307. public void renderGlass(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
  308.  
  309.  
  310. GL11.glPushMatrix();
  311. GL11.glTranslatef(this.Jar.offsetX, this.Jar.offsetY, this.Jar.offsetZ);
  312. GL11.glTranslatef(this.Jar.rotationPointX * f5, this.Jar.rotationPointY * f5, this.Jar.rotationPointZ * f5);
  313. GL11.glScaled(1.07D, 1.04D, 1.07D);
  314. GL11.glTranslatef(-this.Jar.offsetX, -this.Jar.offsetY, -this.Jar.offsetZ);
  315. GL11.glTranslatef(-this.Jar.rotationPointX * f5, -this.Jar.rotationPointY * f5, -this.Jar.rotationPointZ * f5);
  316. this.Jar.render(f5);
  317. GL11.glPopMatrix();
  318. /*
  319. GL11.glPushMatrix();
  320. GL11.glTranslatef(this.JarInside.offsetX, this.JarInside.offsetY, this.JarInside.offsetZ);
  321. GL11.glTranslatef(this.JarInside.rotationPointX * f5, this.JarInside.rotationPointY * f5, this.JarInside.rotationPointZ * f5);
  322. GL11.glScaled(1.07D, 1.0D, 1.07D);
  323. GL11.glTranslatef(-this.JarInside.offsetX, -this.JarInside.offsetY, -this.JarInside.offsetZ);
  324. GL11.glTranslatef(-this.JarInside.rotationPointX * f5, -this.JarInside.rotationPointY * f5, -this.JarInside.rotationPointZ * f5);
  325. this.JarInside.render(f5);
  326. GL11.glPopMatrix();
  327. */
  328.  
  329.  
  330. }
  331.  
  332. /**
  333. * This is a helper function from Tabula to set the rotation of model parts
  334. */
  335. public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
  336. modelRenderer.rotateAngleX = x;
  337. modelRenderer.rotateAngleY = y;
  338. modelRenderer.rotateAngleZ = z;
  339. }
  340. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement