Posted May 20, 20223 yr 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, 20223 yr by Faro
May 21, 20223 yr 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.
May 21, 20223 yr so, did you try full text search? it's not that difficult. it would point you towards the class called IngameGui.
May 21, 20223 yr 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.
May 22, 20223 yr Author 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
May 23, 20223 yr Author 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(); } }
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.