Posted September 19, 20214 yr If I had a block would there be a way of putting the block's texture into the GUI. For example putting the diamond block texture onto the top left corner of the screen. I know I can use RenderGameOverlayEvent.Post to render text but I could not work out how to render images? Edit: I am using 1.17.1 Edited September 19, 20214 yr by Nicknotname
September 29, 20214 yr Here is code and an explanation of how to draw to a screen. PoseStack matrices = event.getMatrixStack(); // Just get a matrix stack int x1 = 0, y1 = 0, x2 = 100, y2 = 100; // Cooordinates to draw the texture at ResourceLocation texture = new ResourceLocation("mod", "path/to/texture.png"); // Texture RenderSystem.setShaderTexture(0, texture); // Bind texture Gui.blit(matrices, x1, y1, x1, y1, x2, y2, x2, y2); // Render texture Hope this helps
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.