Nick82285 Posted November 15, 2018 Share Posted November 15, 2018 (edited) My goal is to display a texture on the screen with transparency and at a certain position. This has been a challenge because the default function Minecraft.ingameGUI.drawTexturedModalRect only shows part of the texture. What's wrong and is there any way to mitigate this? @SubscribeEvent public void doTheOtherThing(RenderTickEvent event) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution scaledRes = new ScaledResolution(mc); mc.getTextureManager().bindTexture(new ResourceLocation("xpsystem:textures/gui/xp_bar.png")); mc.ingameGUI.drawTexturedModalRect(scaledRes.getScaledWidth() / 2, scaledRes.getScaledHeight() / 2, 0, 0, 59, 8); } Here's what I've got so far... https://imgur.com/a/9GAZVt7 (I can't upload images on here except for imgur for some reason). Sidenote: when I use anything but the RenderGameOverlayEvent and I bind the texture it, it binds the texture to the hearts and the hunger bar removing them and turning them into a red bar like the texture. The Texture: Edited November 15, 2018 by Nick82285 Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted November 15, 2018 Share Posted November 15, 2018 2 minutes ago, Nick82285 said: Minecraft.ingameGUI.drawTexturedModalRect only shows part of the texture. what do you mean by this? 3 minutes ago, Nick82285 said: Sidenote: when I use anything but the RenderGameOverlayEvent and I bind the texture it, it binds the texture to the hearts and the hunger bar removing them and turning them into a red bar like the texture. You have to bind it back to the one the minecraft renderer expects it to be (from memory its GuiIngameForge.ICONS) Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
Nick82285 Posted November 15, 2018 Author Share Posted November 15, 2018 2 minutes ago, Cadiboo said: what do you mean by this? It seems to only display the top left pixel of the texture, I would like to display the entire texture. Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted November 15, 2018 Share Posted November 15, 2018 7 minutes ago, Nick82285 said: It seems to only display the top left pixel of the texture, I would like to display the entire texture. 14 minutes ago, Nick82285 said: mc.ingameGUI.drawTexturedModalRect(scaledRes.getScaledWidth() / 2, scaledRes.getScaledHeight() / 2, 0, 0, 59, 8); It's drawing at the middle of the screen from 0,0 to 59,8. Do you want it to draw something else? Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
Nick82285 Posted November 15, 2018 Author Share Posted November 15, 2018 Just now, Cadiboo said: It's drawing at the middle of the screen from 0,0 to 59,8. Do you want it to draw something else? The 0,0 is the place in the texture where I want to start and 59, 8 is the position that I want to stop. Look at the texture Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted November 15, 2018 Share Posted November 15, 2018 (edited) 1 minute ago, Nick82285 said: The 0,0 is the place in the texture where I want to start and 59, 8 is the position that I want to stop. Look at the parameters of the method, they are (xCoord, yCoord, minU, minV, maxU, maxV). You probably want something like drawTexturedModalRectWithCustomSize(x, y, u, v, width, height, textureWidth, textureHeight) Edited November 15, 2018 by Cadiboo Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) Link to comment Share on other sites More sharing options...
Nick82285 Posted November 15, 2018 Author Share Posted November 15, 2018 (edited) 17 minutes ago, Cadiboo said: Look at the parameters mc.ingameGUI.drawTexturedModalRect(x, y, textureX, textureY, width, height); mc.ingameGUI.drawTexturedModalRect(scaledRes.getScaledWidth() / 2, scaledRes.getScaledHeight() / 2, 0, 0, 59, 8); The width is 59, the height is 8, and it starts analyzing the texture at (0, 0) The position is centered on the screen. It just seems to stretch 1 pixel in a 59x8 rectangle, not scale the texture. Edited November 15, 2018 by Nick82285 Quote Link to comment Share on other sites More sharing options...
Cadiboo Posted November 15, 2018 Share Posted November 15, 2018 1 minute ago, Nick82285 said: drawTexturedModalRect expects the texture to be 256x256 17 minutes ago, Cadiboo said: You probably want something like drawTexturedModalRectWithCustomSize(x, y, u, v, width, height, textureWidth, textureHeight) Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme) 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.