grossik

Untitled

Jul 26th, 2016
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. package cz.grossik.farmcraft2.crushing;
  2.  
  3. import cz.grossik.farmcraft2.handler.BlockHandler;
  4. import net.minecraft.block.Block;
  5. import net.minecraft.client.gui.FontRenderer;
  6. import net.minecraft.client.renderer.GlStateManager;
  7. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  8. import net.minecraft.util.ResourceLocation;
  9. import net.minecraftforge.fml.relauncher.Side;
  10. import net.minecraftforge.fml.relauncher.SideOnly;
  11.  
  12. @SideOnly(Side.CLIENT)
  13. public class RendererCrushing extends TileEntitySpecialRenderer<TileEntityCrushing>
  14. {
  15. private static final ResourceLocation SIGN_TEXTURE = new ResourceLocation("farmcraft2:textures/entity/crushing.png");
  16. private final ModelCrushing model = new ModelCrushing();
  17.  
  18. public void renderTileEntityAt(TileEntityCrushing te, double x, double y, double z, float partialTicks, int destroyStage)
  19. {
  20. Block block = te.getBlockType();
  21. GlStateManager.pushMatrix();
  22. float f = 0.6666667F;
  23.  
  24. int i = 0;
  25.  
  26. if (te.hasWorldObj())
  27. {
  28. i = te.getBlockMetadata();
  29. }
  30.  
  31. if (block == BlockHandler.CrushingOff || block == BlockHandler.CrushingOn)
  32. {
  33. GlStateManager.translate((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
  34.  
  35. this.model.Shape1.showModel = true;
  36. this.model.spodek.showModel = true;
  37. this.model.stena1.showModel = true;
  38. this.model.stena2.showModel = true;
  39. this.model.stena3.showModel = true;
  40. this.model.stena4.showModel = true;
  41. this.model.drtic1.showModel = true;
  42. this.model.drtic2.showModel = true;
  43. this.model.drtic3.showModel = true;
  44. this.model.drtic4.showModel = true;
  45. this.model.drtic5.showModel = true;
  46. }
  47.  
  48. if (destroyStage >= 0)
  49. {
  50. this.bindTexture(DESTROY_STAGES[destroyStage]);
  51. GlStateManager.matrixMode(5890);
  52. GlStateManager.pushMatrix();
  53. GlStateManager.scale(4.0F, 2.0F, 1.0F);
  54. GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
  55. GlStateManager.matrixMode(5888);
  56. }
  57. else
  58. {
  59. this.bindTexture(SIGN_TEXTURE);
  60. }
  61.  
  62. int j = 0;
  63.  
  64. if (i == 2)
  65. {
  66. j = 180;
  67. }
  68.  
  69. if (i == 3)
  70. {
  71. j = 0;
  72. }
  73.  
  74. if (i == 4)
  75. {
  76. j = 90;
  77. }
  78.  
  79. if (i == 5)
  80. {
  81. j = -90;
  82. }
  83.  
  84. GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F);
  85.  
  86. GlStateManager.enableRescaleNormal();
  87. GlStateManager.pushMatrix();
  88. GlStateManager.scale(1.0F, -1.0F, -1.0F);
  89. this.model.render();
  90. GlStateManager.popMatrix();
  91. FontRenderer fontrenderer = this.getFontRenderer();
  92. float f3 = 0.015625F * f;
  93. GlStateManager.translate(0.0F, 1.0F, 0.07F * f);
  94. //GlStateManager.scale(f3, -f3, f3);
  95. GlStateManager.glNormal3f(0.0F, 0.0F, -1.0F * f3);
  96. GlStateManager.depthMask(false);
  97. GlStateManager.depthMask(true);
  98. GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  99. GlStateManager.popMatrix();
  100.  
  101. if (destroyStage >= 0)
  102. {
  103. GlStateManager.matrixMode(5890);
  104. GlStateManager.popMatrix();
  105. GlStateManager.matrixMode(5888);
  106. }
  107. }
  108. }
Add Comment
Please, Sign In to add comment