Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Custom Screen Overlay 1.16.5


Faro
 Share

Recommended Posts

Posted (edited)

I want to make a custom screen overlay. So when a boolean is true, I want that the screen to have a red overlay. I looked up in the IngameGui class and the renderPortalOverlay method but I don t know how to make a custom GUI

Edited by Faro
Link to comment
Share on other sites

i tried doing this but cannot find anything in the source code. i looked in 'BlockPumpkin.class' and 'ItemArmor.class' but neither of them have anything about putting a pumpkin on your head. any help is appreciated.

Link to comment
Share on other sites

that helped i found the code. its in a file called GuiIngame.java. i dont know the file path for it but it contains a bunch of code for overlay gui effects and stuff so it should help a lot.

steps to find it in intellij are right click on a folder in the project, click 'find in files' button, search for "pumpkinblur.png" and click the scope button.

Link to comment
Share on other sites

Ok thank you I made it like this and it works.

 @SubscribeEvent
  @OnlyIn(Dist.CLIENT)
  public static void RenderHUD(final RenderGameOverlayEvent event){
        if (isRampage){
           int  screenColor = 0xfff00000;
           Minecraft mc = Minecraft.getInstance();

           
            MatrixStack stack = event.getMatrixStack();
            stack.pushPose();
            int w = (mc.getWindow().getGuiScaledWidth());
            int h = (mc.getWindow().getGuiScaledHeight());

              
                float r = (float) (screenColor >> 16 & 255) / 255.0F;
                float g = (float) (screenColor >> 8 & 255) / 255.0F;
                float b = (float) (screenColor & 255) / 255.0F;
                float a = (1/ 100f) * (screenColor >> 24 & 255) / 255F;

                   RenderSystem.disableTexture();
                   RenderSystem.enableBlend();
                   RenderSystem.disableAlphaTest();
                   RenderSystem.blendFuncSeparate(770, 771, 1, 0);
                   RenderSystem.shadeModel(7425);
                   Tessellator tessellator = Tessellator.getInstance();
                   Matrix4f matrix = stack.last().pose();
                   BufferBuilder worldrenderer = tessellator.getBuilder();
                   worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
                   worldrenderer.vertex(matrix, 0, h, mc.gui.getBlitOffset()).color(r, g, b, a).endVertex();


                   worldrenderer.vertex(matrix, w, h, mc.gui.getBlitOffset()).color(r, g, b, a).endVertex();
                   worldrenderer.vertex(matrix, w, 0, mc.gui.getBlitOffset()).color(r, g, b, a).endVertex();
                   worldrenderer.vertex(matrix, 0, 0, mc.gui.getBlitOffset()).color(r, g, b, a).endVertex();

                   tessellator.end();
                   RenderSystem.shadeModel(7424);
                   RenderSystem.disableBlend();
                   RenderSystem.enableAlphaTest();
                   RenderSystem.enableTexture();
                   


        }
  }

 

Link to comment
Share on other sites

  • Do not use @OnlyIn.
  • Pick one of RenderGameOverlayEvent.Pre or .Post. Not both. For just adding new things to the HUD use .Post.
  • You must check RenderGameOverlayEvent#getType. For just adding new things to the HUD check for ElementType.ALL.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.