Faro Posted May 20, 2022 Share Posted May 20, 2022 (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 May 20, 2022 by Faro Quote Link to comment Share on other sites More sharing options...
MFMods Posted May 20, 2022 Share Posted May 20, 2022 did you look at how carved pumpkin works (when you put it on your head)? Quote Link to comment Share on other sites More sharing options...
Timmy-C137 Posted May 21, 2022 Share Posted May 21, 2022 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. Quote Link to comment Share on other sites More sharing options...
MFMods Posted May 21, 2022 Share Posted May 21, 2022 so, did you try full text search? it's not that difficult. it would point you towards the class called IngameGui. Quote Link to comment Share on other sites More sharing options...
Timmy-C137 Posted May 21, 2022 Share Posted May 21, 2022 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. Quote Link to comment Share on other sites More sharing options...
Faro Posted May 22, 2022 Author Share Posted May 22, 2022 yeah but to use this code I need to make custom GUI and I don t know when to register it or when to call its methods Quote Link to comment Share on other sites More sharing options...
Faro Posted May 23, 2022 Author Share Posted May 23, 2022 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(); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.