Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. package exnihiloadscensio.client.renderers;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import exnihiloadscensio.texturing.Color;
  6. import exnihiloadscensio.tiles.TileBarrel;
  7. import exnihiloadscensio.util.Util;
  8. import net.minecraft.client.renderer.GlStateManager;
  9. import net.minecraft.client.renderer.Tessellator;
  10. import net.minecraft.client.renderer.VertexBuffer;
  11. import net.minecraft.client.renderer.texture.TextureAtlasSprite;
  12. import net.minecraft.client.renderer.texture.TextureMap;
  13. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  14. import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
  15.  
  16. public class RenderBarrel extends TileEntitySpecialRenderer<TileBarrel> {
  17.  
  18. @Override
  19. public void renderTileEntityAt(TileBarrel te, double x, double y, double z,
  20. float partialTicks, int destroyStage)
  21. {
  22. Tessellator tes = Tessellator.getInstance();
  23. VertexBuffer wr = tes.getBuffer();
  24.  
  25. GlStateManager.pushMatrix();
  26. GlStateManager.translate(x, y, z);
  27. //GlStateManager.disableLighting();
  28. if (te.getMode() != null)
  29. {
  30.  
  31. TextureAtlasSprite icon = te.getMode().getTextureForRender();
  32. double minU = (double) icon.getMinU();
  33. double maxU = (double) icon.getMaxU();
  34. double minV = (double) icon.getMinV();
  35. double maxV = (double) icon.getMaxV();
  36.  
  37. this.bindTexture(TextureMap.locationBlocksTexture);
  38.  
  39. wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
  40.  
  41. float fillAmount = te.getMode().getFilledLevelForRender();
  42.  
  43. Color color = te.getMode().getColorForRender();
  44. if (color == null)
  45. color = Util.whiteColor;
  46. wr.pos(0.125f,fillAmount,0.125f).tex(minU, minV).color(color.r, color.g, color.b, color.a).endVertex();
  47. wr.pos(0.125f,fillAmount,0.875f).tex(minU,maxV).color(color.r, color.g, color.b, color.a).endVertex();
  48. wr.pos(0.875f,fillAmount,0.875f).tex(maxU,maxV).color(color.r, color.g, color.b, color.a).endVertex();
  49. wr.pos(0.875f,fillAmount,0.125f).tex(maxU,minV).color(color.r, color.g, color.b, color.a).endVertex();
  50.  
  51. tes.draw();
  52. }
  53.  
  54. GlStateManager.disableBlend();
  55. //GlStateManager.enableLighting();
  56. GlStateManager.popMatrix();
  57.  
  58. }
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement