Guest User

Untitled

a guest
Jul 31st, 2015
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 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.glPopMatrix();
  25.  
  26. }
  27.  
  28. private void renderBlockYour(TileEntityThaumicGen te, World world, int i, int j, int k, Block block) {
  29. TileEntityThaumicGen t = (TileEntityThaumicGen)te;
  30. Tessellator tessellator = Tessellator.instance;
  31. float f = block.getLightValue(world, i, j, k);
  32. int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
  33. int l1 = l % 65536;
  34. int l2 = l / 65536;
  35. tessellator.setColorOpaque_F(f, f, f);//System.out.println(t.getFacing().ordinal());
  36. OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);
  37. int dir = world.getBlockMetadata(i, j, k);
  38. switch(t.getFacing().ordinal()) {
  39. case 2:
  40. GL11.glRotatef(180, 0, 1, 0);
  41. GL11.glTranslatef(0F, -1.5F, 1F); // +0.5, -0.5, +1
  42. break;
  43. case 3:
  44. GL11.glRotatef(0, 0, 1, 0);
  45. GL11.glTranslatef(1F, -1.5F, 0F);
  46. break;
  47. case 4:
  48. GL11.glRotatef(90, 0, 1, 0);
  49. GL11.glTranslatef(1F, -1.5F, 1F);
  50. break;
  51. case 5:
  52. GL11.glRotatef(270, 0F, 1F, 0F);
  53. GL11.glTranslatef(0F, -1.5F, 0F);
  54. break;
  55. default:
  56. }
  57. GL11.glRotatef(dir * (-90F), 0F, 1F, 0F);
  58. GL11.glTranslatef(-0.5F, 0F, -0.5F);
  59. Minecraft.getMinecraft().renderEngine.bindTexture(TEX);
  60. this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
  61. }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment