Fire RenderGameOverlayEvent for vignette (#4360)

This commit is contained in:
Marvin Rösch 2017-09-06 14:19:56 -07:00 committed by LexManos
parent fe3ba2b40e
commit cb8cace92d
2 changed files with 18 additions and 2 deletions

View file

@ -71,6 +71,7 @@ public class GuiIngameForge extends GuiIngame
//Flags to toggle the rendering of certain aspects of the HUD, valid conditions
//must be met for them to render normally. If those conditions are met, but this flag
//is false, they will not be rendered.
public static boolean renderVignette = true;
public static boolean renderHelmet = true;
public static boolean renderPortal = true;
public static boolean renderHotbar = true;
@ -120,7 +121,7 @@ public class GuiIngameForge extends GuiIngame
mc.entityRenderer.setupOverlayRendering();
GlStateManager.enableBlend();
if (Minecraft.isFancyGraphicsEnabled())
if (renderVignette && Minecraft.isFancyGraphicsEnabled())
{
renderVignette(mc.player.getBrightness(), res);
}
@ -247,6 +248,20 @@ public class GuiIngameForge extends GuiIngame
post(BOSSHEALTH);
}
@Override
protected void renderVignette(float lightLevel, ScaledResolution scaledRes)
{
if (pre(VIGNETTE))
{
// Need to put this here, since Vanilla assumes this state after the vignette was rendered.
GlStateManager.enableDepth();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
return;
}
super.renderVignette(lightLevel, scaledRes);
post(VIGNETTE);
}
private void renderHelmet(ScaledResolution res, float partialTicks)
{
if (pre(HELMET)) return;

View file

@ -66,7 +66,8 @@ public class RenderGameOverlayEvent extends Event
DEBUG,
POTION_ICONS,
SUBTITLES,
FPS_GRAPH
FPS_GRAPH,
VIGNETTE
}
private final float partialTicks;