Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. private void renderNightvisionOverlay(Minecraft minecraft)
  2. {
  3.     ItemStack itemstack = minecraft.thePlayer.inventory.armorItemInSlot(3);
  4.     if(!minecraft.gameSettings.thirdPersonView && itemstack != null)
  5.     {
  6.         if(itemstack.itemID == itemNightvisionGoggles.shiftedIndex && nightvisionEnabled)
  7.         {
  8.             renderTextureOverlay(minecraft, "%blur%/misc/nightvision.png", 1F);
  9.         }
  10.     }
  11. }
  12.  
  13. private void renderTextureOverlay(Minecraft mc, String texturePath, float alpha)
  14. {
  15.     ScaledResolution scaledresolution = new ScaledResolution(mc.displayWidth, mc.displayHeight);
  16.     int width = scaledresolution.getScaledWidth();
  17.     int height = scaledresolution.getScaledHeight();
  18.    
  19.     GL11.glEnable(3042 /*GL_BLEND*/);
  20.     GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
  21.     GL11.glDepthMask(false);
  22.     GL11.glBlendFunc(770, 771);
  23.     GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
  24.     GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
  25.     GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture(texturePath));
  26.     Tessellator tessellator = Tessellator.instance;
  27.     tessellator.startDrawingQuads();
  28.     tessellator.addVertexWithUV(0.0D, height, -90D, 0.0D, 1.0D);
  29.     tessellator.addVertexWithUV(width, height, -90D, 1.0D, 1.0D);
  30.     tessellator.addVertexWithUV(width, 0.0D, -90D, 1.0D, 0.0D);
  31.     tessellator.addVertexWithUV(0.0D, 0.0D, -90D, 0.0D, 0.0D);
  32.     tessellator.draw();
  33.     GL11.glDepthMask(true);
  34.     GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
  35.     GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
  36.     GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement